|
Posted by Al Dunbar on 12/07/05 07:41
"McKirahan" <News@McKirahan.com> wrote in message
news:LK-dnXY_JJEBJBLenZ2dnUVZ_sydnZ2d@comcast.com...
> "Highlander" <tron9901@msn.com> wrote in message
> news:1133484142.392489.167190@g43g2000cwa.googlegroups.com...
>>
>> McKirahan wrote:
>> > "Highlander" <tron9901@msn.com> wrote in message
>> > news:1133482432.710124.52790@g49g2000cwa.googlegroups.com...
>> >
>> > [snip]
>> >
>> > > Since I've seen the "set variable = nothing" in many scripts, and
>> > > have
>> > > been told that this is done to release memory, I assumed that it
> needed
>> > > to be done with every variable. If this isn't the case, what's the
>> > > criteria for when it should be used for a given variable?
>> >
>> > Objects are "Set" and may be assigned to "Nothing" when through.
>> >
>> > For example,
>> >
>> > Set FSO = CreateObject("Scripting.FileSystemObject")
>> > ...
>> > Set FSO = Nothing
>>
>> I did this with every object that was "Dimmed". So you're saying that I
>> only need to take every object that was "Set" and assign them to
>> "Nothing" when through?
>>
>
> Exactly.
Note, however, that there are cases where it is not actually necessary to
set an object variable to nothing. This happens automatically when the
variable goes out of scope. Also, simply setting an object variable to
nothing may NOT be all that is required to properly clean things up - think
of the need to .close an output file, for one obvious example.
/Al
[Back to original message]
|