sastowe
14 years agoSuper Contributor
vbscript and garbage collection
I am in the habit of setting object variables to nothing when I am done with them. Somewhere in my past, I heard that the microsoft scripting engine had in-determinant timing of their garbage collection. Unlike VB6, garbage collection was done who only knew when. So we cannot count on those resources being recovered when the variables go out of scope? Is my memory making stuff up? Is this true or bogus? What do all y'all do? Thanks
S
S
- I too was in the habit of emptying all variables at the end of a routine in VBScript, but some reading on the subject convinced me that it's not necessary in most cases. Here are a few links to articles:
http://automate101.wordpress.com/2010/10/24/understanding-script-gc/
http://blogs.msdn.com/b/ericlippert/archive/2004/04/28/when-are-you-required-to-set-objects-to-nothing.aspx
Since reading those articles, I've toned it down a lot.