nutso fasst wrote:
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:Od**************@TK2MSFTNGP03.phx.gbl...
>> Set Application("var") = Nothing
creates an empty object.
or dereferences an existing one.
In this case it changed an existing item into an object reference.
Why is that relevant? The memory occupied by a reference to Nothing should
be negligable. It should certainly be less than the memory previously
occupied by that variable.
>
>I don't understand the requirement to "remove" the variable. If your
goal is simply to reclaim memory space, then setting the variable to
nothing should do that.
<snip>
>
Whether I assign it a null value or an empty string, or set it to
Nothing (in which case the above code reports it has become an
object), the variable is still there. If the variable exists then
there is still memory being used for the variable. So dynamically
creating application variables with names based on visitor IP
addresses, for example, will constitute a virtual memory leak as the
Application.Contents collection grows and grows.
Ah. OK. Have you tested the effect of such a "leak" on your appliction? If
so, and your testing indicates that it will cause a problem, then yes, you
will need to use some sort of array- or xml document-based solution (if the
latter, make sure you use the free-threaded version, or simply store the xml
string)
You should be aware that arrays have their own "issues", i.e., the inability
to remove elements except from the end of the array. Javascript arrays are
superior to vbscript arrays in this respect. Also, since you will need to
lock and unlock application when updating this variable, you will cause it
to be serialized, impacting your application's performance.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"