473,386 Members | 1,827 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,386 software developers and data experts.

Objects set to nothing

Hi,
anyone have better information on IIS 5.0 memory behaviour
on setting objects to nothing?

Connections and recordsets of course should be set to
nothing, but should for example XMLNode object be set to
nothing?

Thanks, Tony

Jul 19 '05 #1
1 5414
Setting to Nothing is a bit of a misnomer in that as soon as the current ASP
page goes out of scope (eg. has completed processing) then all objects are
contacted and told to destroy themselves anyway.
It is true that in a stateful environment such as a classic VB application
that not setting global and module level objects to Nothing can have an
adverse effect on memory usage since those objects may remain in scope (and
thus in memory) for a lot longer than anticipated.
I have seen a classic example of this in my own application working with a
mail archive (1000+ mails). I enumerated them to a collection and held a
mail COM object for each. I forgot to set the object to nothing as I was
running through the collection collecting the header information resulting
in a dramatic rise in memory to over 500Mb. When I realised the mistake and
then set each mail object to nothing after I had finished with it then the
memory remained static at < 2Mb.
However, in ASP, only application and session objects [not strictly true -
see later] persist beyond the scope of a single ASP page being processed and
so the issue of 'managing' the objects lifetime becomes moot....as the page
completes then all objects go out of scope automatically.
There is a situation in which setting to Nothing must be done [in fact you
need to call the relevant .Quit method first] ... when working with
ActivexEXE Servers. These objects create out of process copies of certain
public classes that can be made to persist outside the scope of a page. This
is due to the fact that the class object is referenced by the ActivexEXE
Server, not the ASP page. A good example is instantiating an instance of
Excel in an ASP page and not calling .Quit on it before the page completes
..... Excel will remain active and in memory but divorced from all efforts to
communicate with it. Excel is in fact an ActivexEXE Server as is Word, etc.
That's one of the main issues with trying to use Excel server-side in a web
environment, it has the capability to eat up all the server memory if you
get it wrong.

My apologies if I get anything slightly mis-quoted, it's a bit of a
contentious subject with IIS and I'm not an MVP (although I'd like to be at
some point if I can ever find the time to do the exams etc.).

Hope this helps,

Chris.

"Tony" <an*******@discussions.microsoft.com> wrote in message
news:02****************************@phx.gbl...
Hi,
anyone have better information on IIS 5.0 memory behaviour
on setting objects to nothing?

Connections and recordsets of course should be set to
nothing, but should for example XMLNode object be set to
nothing?

Thanks, Tony
Jul 19 '05 #2

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

Similar topics

4
by: Chuck Ritzke | last post by:
I keep asking myself this question as I write class modules. What's the best/smartest/most efficient way to send a large object back and forth to a class module? For example, say I have a data...
1
by: MS | last post by:
When is it appropriate to "close" objects? Example. Which of these objects should be "closed"? Dim Wsp as Workspace Dim Dbf as DataBase Dim Rstb as Recordset Dim Tdf As TableDef Dim Cdb As...
106
by: xtra | last post by:
Hi Folk I have about 1000 procedures in my project. Many, many of them are along the lines of function myfuntion () as boolean on error goto er '- Dim Dbs as dao.database Dim Rst as...
10
by: Cy | last post by:
I've had good luck with posting in the past, so we'll see how things go this time...:) I have an Access 2000 form. On the form is about 40 objects. I want to set everything to invisible,...
8
by: vvenk | last post by:
Hello: I just wrote my first ASP.Net application. It worked fine on my machine and when I put into production, the ASP.Net process reaches 50% quite fast and then the system does not work...
161
by: KraftDiner | last post by:
I was under the assumption that everything in python was a refrence... so if I code this: lst = for i in lst: if i==2: i = 4 print lst I though the contents of lst would be modified.....
167
by: darren | last post by:
Hi I have to write a multi-threaded program. I decided to take an OO approach to it. I had the idea to wrap up all of the thread functions in a mix-in class called Threadable. Then when an...
41
by: =?Utf-8?B?VGltIE1hcnNkZW4=?= | last post by:
Hi, I am after suggestions on the best practice declaring and destroying objects. some example code: Private Sub MySub Dim frmMyForm As MyForm Try
29
by: Jerry Spence1 | last post by:
I'm rather confused as to whether something should be disposed of, or not. What is the general rule? How can you be sure of doing the right thing? I've heard about disposing unmanaged resources but...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.