I have heard a lot of conflicting reports/advice and was wondering if someone
could finally put a question to rest for me. I am programming .asp (vbscript)
pages with IIS 6.0. My question is if I declare a variable within a .asp
page, how or when is it destoryed (cleared from memory)?

Does IIS 6.0 automatically destory it when the page closes out?
Do I need to manually close/destory it (Set somevariable=Nothing)?

I have heard that if you do not manually close out each variable you
declare, then you can create a memory leak within IIS 6.0...which would be
bad.

Though on the flip side I have heard that when you simply browse away from a
page, IIS 6.0 will automatically close the variables for you?

If in fact you do need to manually close out each variable you declare, is
there a debugging tool available that I could use to check my programming to
make I didn't forget to close out any variables? I have searched around the
net and have found nothing for .asp (vbscript) pages.

Thank you in advance you for advice!!

Re: Closing a variable by Anthony

Anthony
Thu May 11 01:59:54 CDT 2006


"ckrosnowski" <ckrosnowski@discussions.microsoft.com> wrote in message
news:A16C1175-72A7-4E3E-8780-E2C45F1ADDFB@microsoft.com...
> I have heard a lot of conflicting reports/advice and was wondering if
someone
> could finally put a question to rest for me. I am programming .asp
(vbscript)
> pages with IIS 6.0. My question is if I declare a variable within a .asp
> page, how or when is it destoryed (cleared from memory)?
>
> Does IIS 6.0 automatically destory it when the page closes out?
> Do I need to manually close/destory it (Set somevariable=Nothing)?
>
> I have heard that if you do not manually close out each variable you
> declare, then you can create a memory leak within IIS 6.0...which would be
> bad.

You do not need to manually set object variables to nothing.

There is much FUD about this due to an old problem with an now very old
version of ADO which has long been fixed.

That said many objects will expose some kind of 'close' method (e.g., ADO
recordset and stream objects). You should make sure that such methods are
called, however it isn't necessary to then set the variable to nothing.

>
> Though on the flip side I have heard that when you simply browse away from
a
> page, IIS 6.0 will automatically close the variables for you?
>

IIS knows nothing of the browser. The script context will be destroyed
after the request has been completed, that is soon after the page content is
delivered to the browser. The browser can maintain that page open all day
but the IIS has finished with it as soon as it has delivered it to the
browser.

> If in fact you do need to manually close out each variable you declare, is
> there a debugging tool available that I could use to check my programming
to
> make I didn't forget to close out any variables? I have searched around
the
> net and have found nothing for .asp (vbscript) pages.

None that I know of. Probably because it isn't really needed.

>
> Thank you in advance you for advice!!