Page 1 of 1

Detecting Memory Leak in ASP .Net

Posted: Tue Jun 10, 2008 10:35 am
by guru
I'm currently evaluating .Net Memory Profiler 3.1. I have an ASP .NET application and I want to know if there is memory leaking. So far the tutorial is very instructive, however, I believe it only applies to stateful applications such as Windows Development.
However, in a stateless application such as ASP .Net, should I interpret the results differently? Should I approach the detection differently as well?

Currently this is what I'm doing, I want to make sure if it is correct:
a. Start the profiler on my ASP .Net application.
b. Wait until the page completely loads and then get a snapshot.
c. Since it is a stateless application all the object instances should be disposed as soon as the page load, so I need to just look at the live instances column in the instance page and all the objects in those columns can be considered as a leaking memory, right?

Posted: Tue Jun 10, 2008 8:58 pm
by Andreas Suurkuusk
The page rendering in ASP.NET is stateless and after requesting a page there should be no new instances related to the page rendering. But, you will still have other instances in an ASP.NET application. The ASP.NET Framework will create and keep instances alive, and even if the page rendering is stateless, an ASP.NET application at least needs to keep track of session state. I recently wrote a reply to another ASP.NET question, which might provide you with some additional information. The post can be found at:

http://memprofiler.com/forum/viewtopic.php?t=1230

To minimize the impact of session state and caching, try to lower the timeouts for the cache and session, and wait for the timeout to elapse before collecting the next snapshot.