c# - Is it necessary to free objects in final block of try-catch block? -


the question self explanatory :

foo objfoo; try {   objfoo = new foo();   ..........   ......... } catch {  } {   objfoo = null; }  

is necessary free objects ?

note: setting local / field null not freeing value. instead removing reference value may or may not make elligable collection during next gc cyle.

to answer question, no not necessary. jit`er calculate last time local used , remove local 1 of object's gc roots @ time. nulling local out not speed process.

raymond chen did excellent article on subject


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -