Denaes Posted May 3, 2004 Posted May 3, 2004 I know that when you're inside of a procedure and make declarations, their scope is only within that procedure (sub or function or class). I've seen mention of calling dispose to get rid of some instances of variables when unneeded, but do all variables need to be disposed in this manor? If I call a sub, once that sub is over, won't it (eventually) collect all the resources from that sub? What sorts of things should you dispose of, anything that involved New? Quote
Administrators PlausiblyDamp Posted May 3, 2004 Administrators Posted May 3, 2004 http://www.xtremedotnettalk.com/showthread.php?t=74918&highlight=garbage+collection+dispose http://www.xtremedotnettalk.com/showthread.php?s=&threadid=69454 may be worth a read. In brief you really only need to look at using dispose if the objects you are creating hold references to limited / critical / expensive resources (file handles, database connections etc.) Variables that contain references to objects will ultimately be garbages collected when .Net feels there is a need. Value types (structs) will be reclaimed as soon as the procedure exits. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.