How to profile ASP.Net memory leak
koger
Posts: 3
Hello
I'm trying ANTS profiler to see if it can help me. I have an ASP.Net website, that leaks memory. I found out by looking at the Windows Task Manager and saw that the memory usage just keep rising. Looking at the logs it seems to start a garbage collection, but no memory is actually freed.
I run the ANTS in this way, choose the wizard, point to my local http path using IIS 5.
I start the profiling, take a snapshot, wait for session to timeout (I see this in adminstration/permance tool where I add all counters for ASP.Net applications). I then take a second snapshot and close the browser.
So is it ok so far?
How do I now see what's causing my memory leaks?
I'm trying ANTS profiler to see if it can help me. I have an ASP.Net website, that leaks memory. I found out by looking at the Windows Task Manager and saw that the memory usage just keep rising. Looking at the logs it seems to start a garbage collection, but no memory is actually freed.
I run the ANTS in this way, choose the wizard, point to my local http path using IIS 5.
I start the profiling, take a snapshot, wait for session to timeout (I see this in adminstration/permance tool where I add all counters for ASP.Net applications). I then take a second snapshot and close the browser.
So is it ok so far?
How do I now see what's causing my memory leaks?
Comments
Diagnosing an ASP .NET memory leak is the same as any other memory leak; you will try to find the root objectthat is holding a reference. The only difference I can think of is that with ASP .NET, the reference may be held because of the server configuration, for instance if you have stored information in the user session. In that case reducing the session time may ease the memory problem better than changing the code.
public class AccordionPaneAdapter : IGroup
{
private static readonly Dictionary<AccordionPane, IGroup> paneGroups = new Dictionary<AccordionPane, IGroup>();
private readonly AccordionPane pane;
public AccordionPaneAdapter(AccordionPane pane)
{
this.pane = pane;
Debug.Assert(!paneGroups.ContainsKey(pane));
paneGroups.Add(pane, this);
}
...
Off the top of my head, maybe writing some sort of cleanup method to remove() all items from the dictionary would help, but I'm not sure.