How to profile ASP.Net memory leak

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?

Comments

  • Thanks for your post.

    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.
  • Hmm.. after searching for a long time, I stumpled apon an object which is an root object. Examing the code, I don't really think this is the real cause of the leak. Here is a summary of 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);
    }
    ...
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Sorry, but I don't see enough information to be able to offer any sensible advice about stopping any potential memory leak.

    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.
Sign In or Register to comment.