Bob Barrows said:
How is this any different from what I wrote?
I see now it's not (said the blind carpenter, as he picked up his hammer and
saw).
or dereferences an existing one.
In this case it changed an existing item into an object reference.
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.
That doesn't quite happen. Using this code to show variables:
For Each Item in Application.Contents
If IsObject(Application.Contents(Item)) Then
Response.Write Item & " is an object.<br>"
ElseIf IsArray(Application.Contents(Item)) Then
Response.Write Item & " is an array.<br>"
Else
Response.Write Item & "=" & Application.Contents(Item) & "<br>"
End If
Next
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.
nf