473,769 Members | 3,383 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET memory management

We're developing our first large scale ASP.NET web application and I'm a
little concerned over memory usage of aspnet_wp.exe on the development
server during testing. The application appears to use a lot of memory and
I've got the feeling that it's not all been released.

Some initial questions:

When a session times out, is ASP.NET/CLR supposed to release every resource
allocated during the session?

Is there anyway to display what's happening on a IIS server when it's
running an application? A log of some kind. Just memory per session would be
a start.

Are there any configuration options around memory management of ASP.NET on
IIS?

Despite what I've heard, do you actually have to carry out manual disposal
and memory collection. I've come from the VB6 world where the classic
circular reference (Obj1 points to Obj2 and Obj2 points to Obj1) causes both
objects (and their children) to stay in memory even though Obj1 and Obj2 are
both cleared to nothing. I currently believe the dream that CLR garbage
collection does work. I hope I can carry on with this dream... Waking up
into reality and having to implement cleanup code throughout the application
is more of a nightmare than a dream.

Cheers, Rob.


Nov 19 '05 #1
1 1710
HI Rob, see inline:

On Wed, 27 Jul 2005 09:56:20 +0100, "Rob Nicholson"
<in******@commu nity.nospam> wrote:
We're developing our first large scale ASP.NET web application and I'm a
little concerned over memory usage of aspnet_wp.exe on the development
server during testing. The application appears to use a lot of memory and
I've got the feeling that it's not all been released.

Some initial questions:

When a session times out, is ASP.NET/CLR supposed to release every resource
allocated during the session?

Memory resources will be taken care of by the garbage collector -
eventually. Chances are it will not happen at the exact moment a
session times out. Server processes in general tend to not give up
memory easily, chances are they will need it again in the future.
Chances are you may not have a problem, the best way to find out would
be to do some simulated stress testing. Saying a process uses "a lot"
of memory is too relative.
Is there anyway to display what's happening on a IIS server when it's
running an application? A log of some kind. Just memory per session would be
a start.

You could start with perfmon, which comes with the operating system.
Under the .NET CLR Memory counter category pay particular attention to
the Large Object Heap size and Gen 2 heap size. These areas contain
the large objects and the objects that are hanging around the longest.

There are also memory profilers you can use - CLRProfiler is free [1].
WinDbg [2] is the best tool for seeing exactly what you have on the
heap, but has a steep learning curve and too many details for most
memory scenarios. Still, the latest version has an extension command
(!dac for DumpAspnetCache ) that can show you exactly what is in the
cache (ASP.NET keeps Sessions in the Cache collection internally).
Are there any configuration options around memory management of ASP.NET on
IIS?

You can set q peak amount of memory for the worker process to use,
once it hits this number the application recycles, which might not be
what you want. In IIS 6.0 this is set on the Application Pool
properties dialog.
Despite what I've heard, do you actually have to carry out manual disposal
and memory collection. I've come from the VB6 world where the classic
circular reference (Obj1 points to Obj2 and Obj2 points to Obj1) causes both
objects (and their children) to stay in memory even though Obj1 and Obj2 are
both cleared to nothing. I currently believe the dream that CLR garbage
collection does work. I hope I can carry on with this dream... Waking up
into reality and having to implement cleanup code throughout the application
is more of a nightmare than a dream.


Circular references are definitely not a problem in .NET.
[1]
http://www.microsoft.com/downloads/d...displaylang=en

[2] http://www.microsoft.com/whdc/devtoo...g/default.mspx

--
Scott
http://www.OdeToCode.com/blogs/scott/
Nov 19 '05 #2

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

Similar topics

0
1879
by: Richard Jones | last post by:
Garbage Collection & Memory Management Summer School 20-21 July 2004, Canterbury, UK The performance of today's memory-hungry applications depends on efficient dynamic memory management, whether managed explicitly through new/delete or automatically by a garbage collector. With the increasing use of managed code, whether Java Virtual Machines or Microsoft's Common Language Runtime, the economic importance of automatic memory management...
2
1967
by: DANIEL BEAULIEU J | last post by:
Basically i am a student taking an operating systems course which is c++ intensive. Familiar with Java, and so not so familiar with memory management. Looking for suggestions of exercises or web resources to help me become familiar with pointers and referencing etc. Thank you.
9
2354
by: Mike P | last post by:
I know everything about reference counting and making sure you don't have large objects lying around. I have also profiled my app with multiple tools. I know about the fact GC collects memory but not necessary give it back to the OS. It seems that .NET win app will only return memory to the OS when the OS is asking for it. But!!! When the OS is asking for it is usually too late, tons of swapping and slow performance.
8
9336
by: Chad | last post by:
hello, i am losing memory each time i make this call to a C++ dll (I make frequent calls). 'in VB.Net Declare Function grab Lib "grabber.dll" _ (ByRef lpBuf As Byte, ByVal lnum As Integer) As Integer the C++ function is...
1
2800
by: trialproduct2004 | last post by:
Hi all, I am having slight confusion regarding memory management in .net. Say suppose i have two application one is in C# and other is in MFC(VC++). Both of this application are using lots of memory. Suppose i run first C# application which has occupied all memory and
0
1936
by: erez_acount | last post by:
***************************************************************************** Call For Papers The 2006 International Symposium on Memory Management (ISMM'06) Co-located with PLDI 2006 Ottawa, Canada June 10-11 2006
94
4770
by: smnoff | last post by:
I have searched the internet for malloc and dynamic malloc; however, I still don't know or readily see what is general way to allocate memory to char * variable that I want to assign the substring that I found inside of a string. Any ideas?
3
5327
by: Jim Land | last post by:
Jack Slocum claims here http://www.jackslocum.com/yui/2006/10/02/3-easy-steps-to-avoid-javascript- memory-leaks/ that "almost every site you visit that uses JavaScript is leaking memory". Anybody know anything about this? Does *Javascript* leak memeory, or does the *browser* leak memory?
9
2345
by: benoit808 | last post by:
I don't have a lot of experience with C++ so I apologize if this is a stupid question. I use Paul Nettle's memory manager (mmgr.cpp) which reports a memory leak but I don't think there's one. Here is the code (i took some stuff out to simplify): void myFunction() { Sprite *pImage; sprintf(pStr, "s04-%02d.png", i);
5
24788
by: kumarmdb2 | last post by:
Hi guys, For last few days we are getting out of private memory error. We have a development environment. We tried to figure out the problem but we believe that it might be related to the OS (I am new to Windows so not sure). We are currently bouncing the instance to overcome this error. This generally happen at the end of business day only (So maybe memory might be getting used up?). We have already increased the statement heap & ...
0
9586
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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
10043
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...
0
9861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8869
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7406
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...
1
3956
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
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
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.