> If a variable or object is declared in a sub or function, when the
> function terminates, the memory allocated to said variable/object
> released on the stack of the thread that called the sub/function.
> Why then, is it pushed in VB groups to set objects to nothing before
It confirms that you expect the object to be released and that you did
not just misunderstand scope issues which also makes it easier to go
back to the app or to somebody else's app later for maintenance.
It does no harm if VB's automatic release is working and resolves the
problem if in any version of VB the objects are not properly released.
Quote:> Obviously performing object cleanup such as closing recordsets is
> to free up db resources etc. and this should also be done before
> the app.
Why do you think closing recordsets when a sub ends is obviously
important but setting the object=Nothing isn't? Any well-behaved
object will close all alloctaed resources when it gets terminated and
it gets temrinated when it goes out of scope so neither action is
technically needed... unless something isn't "well-behaved" in which
case doing your own cleanup on all points reduces the chance of
Quote:> However, surely there is no need to set local objects to nothing
Need? probably not. Good programming practice? Absolutely.
Quote:> Global objects may need managed in this way to conserve app wide
> resources but I do not see the need for this to be done at
All objects should be managed the same way for consistency, if nothing
Quote:> Can anyone explain the need for setting objects to nothing before
Sent via Deja.com http://www.deja.com/
Before you buy.