473,796 Members | 2,590 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5449
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*******@disc ussions.microso ft.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
2164
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 access module that creates a large disconnected dataset from a database. I want to pass that dataset back to the calling program. And then perhaps I want to send that dataset to another class module. At first it seems that the "object oriented"...
1
1546
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 DataBase
106
6478
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 dao.recordset
10
10118
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, except a drop down box. Once the user selects from the pull down menu, I have code that picks the applicable fields to be visible. Thus, if a user makes changes to the pull down menu, ie. changes the value in the pull down, I need everything to go...
8
1952
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 anymore until I kill that process. Obviously, this is not acceptable. Looking back, I do not destroy any objects in my form. Would that be the reasn why the application breaks down?
161
7892
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.. (After reading that
167
8368
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 object should run in its own thread, it should implement this mix-in class. Does this sound like plausible design decision? I'm surprised that C++ doesn't have such functionality, say in its STL. This absence of a thread/object relationship in...
41
1914
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
2393
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 what is an unmanaged resource? Does everything need disposing? I've been using Webrequest, Webresponse, Streamreaders etc. How can I be sure of what needs disposing? Do these get automatically get disposed of at the end of the procedure...
0
9533
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10461
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10239
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10190
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7555
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6796
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5579
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4122
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.