473,387 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

IIS4 application variable removal

Hi. Any way to do this from asp page in IIS4? Application.Contents.Remove is
IIS 5+. Setting variable to empty string does not remove variable.

thx,
nf
Oct 21 '06 #1
10 1935
try something like this

for each val in Application.contents
Application(val) = null
next
"nutso fasst" <no********@no.wherewrote in message
news:e7**************@TK2MSFTNGP03.phx.gbl...
Hi. Any way to do this from asp page in IIS4? Application.Contents.Remove
is
IIS 5+. Setting variable to empty string does not remove variable.

thx,
nf


Oct 22 '06 #2
nutso fasst wrote:
Hi. Any way to do this from asp page in IIS4?
Application.Contents.Remove is IIS 5+. Setting variable to empty
string does not remove variable.
I suspect Set Application("var") = Nothing will suit your purpose.

--
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"
Oct 22 '06 #3

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:#Z**************@TK2MSFTNGP05.phx.gbl...
I suspect Set Application("var") = Nothing will suit your purpose.
No, that produces an error. And this:
Set Application("var") = Nothing
creates an empty object. The variable is not removed.

Guess I'll just have to work with arrays stored in variables declared in
global.asa. No remove function was dumb!

thx 4 reply,
nf
Oct 23 '06 #4

"Slim" <me@here.comwrote in message
news:eY**************@TK2MSFTNGP04.phx.gbl...
try something like this

for each val in Application.contents
Application(val) = null
next
Nope, setting the variables to null doesn't remove the variables.

thx,
nf
Oct 23 '06 #5
nutso fasst wrote:
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:#Z**************@TK2MSFTNGP05.phx.gbl...
>I suspect Set Application("var") = Nothing will suit your purpose.

No, that produces an error. And this:
Set Application("var") = Nothing
How is this any different from what I wrote?
creates an empty object.
or dereferences an existing one.
The variable is not removed.

Guess I'll just have to work with arrays stored in variables declared
in global.asa. No remove function was dumb!
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.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Oct 23 '06 #6

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:Od**************@TK2MSFTNGP03.phx.gbl...
No, that produces an error. And this:
Set Application("var") = Nothing

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).
creates an empty object.

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
Oct 23 '06 #7
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"
Oct 24 '06 #8

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:OM**************@TK2MSFTNGP04.phx.gbl...
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
Yeah, slice is nice. In this case the only messing with the middle of an
array is to remove matching items, which I'm doing thusly:

myarray = Split(Replace(Replace(Replace(Join(myarray),remite m & " ","")," "
& remitem,""),remitem,"")
lock and unlock application when updating this variable, you will cause it
to be serialized, impacting your application's performance.
Yep. Just have to see how it goes.

Anyway, the no-remove limitation was actually a good thing as it works
better keeping the dynamic variables on the client.

thx,
nf

Oct 25 '06 #9

"nutso fasst" <no********@no.wherewrote in message
news:eq**************@TK2MSFTNGP04.phx.gbl...
>
"Slim" <me@here.comwrote in message
news:eY**************@TK2MSFTNGP04.phx.gbl...
>try something like this

for each val in Application.contents
Application(val) = null
next

Nope, setting the variables to null doesn't remove the variables.
Sorry i misread your post
>
thx,
nf


Oct 26 '06 #10
Make sure to leave out parenthesis:
Application.Contents.Remove "something"
Oct 30 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Richard | last post by:
Having trouble getting Session to persist. Have checked properties of the Virtual Directory in IIS4 manager and "Enable Session State" is checked, with time out set to 20 Mins. Have also checked...
1
by: JORGEMAL | last post by:
I migrated a VID6 application from Windows NT 4 to Windows 2003 Server (IIS4 to IIS6) which was developed using ASP and VBScript and I now I am getting an error message as follows: Microsoft OLE...
1
by: Kevin Callanan | last post by:
I have upgraded my website from IIS4.0 on an NT Server to IIS6.0 on a 2003 Server now when my asp pages try to load they get a error 500 - Internal Server Error Any Idea?
4
by: Tarique Jawed | last post by:
Alright I needed some help regarding a removal of a binary search tree. Yes its for a class, and yes I have tried working on it on my own, so no patronizing please. I have most of the code working,...
3
by: sanjana | last post by:
hi willy i have done the code for detecting insertion/removal of device at USB port thanx for ur advice but is there way to detect if sd card is inserted or removed from the device at usb tht...
6
by: Dirc Khan-Evans | last post by:
I have a problem with a Session variable that dissapears after a postback of one of my pages. This only happens on WIn 2003 servers.. it is fine on my XP dev box. This page opens in another...
1
by: John_H | last post by:
Re: ASP.NET 2.0 I would like suggestions or code examples on how to collect a variable length list of input data (item# & item quantity specifically). I thought that I could accomplish this...
3
by: tschwartz | last post by:
I'm trying to write a stylesheet which removes nodes which are empty as a result of other template processing. For example, given the following xml, I'd like to: - remove all "b" elements -...
30
by: Adam | last post by:
Hi, I have a simple printf-like function: int print(const char *format, ...) { char buffer; va_list argptr; int i;
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.