[thelist] VBScript Question about Empty and Nothing

Scott Dexter sgd at ti3.com
Thu Nov 1 11:55:17 CST 2001

> When setting a variable 
> to Nothing
> after using it as an object, is it necessary (or good 
> programming practice)
> to set the variable to Empty, as in the following code?

AFAIK, The object does get torn down when you set it to Nothing, but the
object *reference* stays around until you set it to Empty. I don't know
at which point the object is dumped from memory (the docs tell us it's
when you set it to Nothing, but I don't buy it)

To be the absolute cleanest, I recommend doing both; better safe than

> Also, a related question, if I Dim a variable 
> in a procedure
> and use it, should I declare that variable as Empty at the end of the
> procedure, or does it really matter either?

local vars in this scope will get cleaned up automagically. This one you
don't gotta worry 'bout =)



More information about the thelist mailing list