looking for memory leak

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
Posts: 1
Joined: Thu Jun 13, 2013 1:42 pm

looking for memory leak

Post by CurrieD88 » Thu Jun 13, 2013 1:56 pm

I have an application that loads 2 user controls into a tabbed interface. Each of these controls has the capability of running very large reports. Here is the steps that cause an out of memory exception:
The large report described below is the same report, accessing and displaying around 150k rows of data.

Run application (take snapshot)
Load control A
run 2 small reports
Load control B
run large report
close tab containing control B
run large report in control A
close tab containing control A (At this point i take second snapshot)
Load control B
Run large report
Boom - out of memory exception

To troubleshoot, I reduced the amount of rows to 50k and ran the application with memory profiler. I take snapshots at the points indicated above. My delta memory looks good (it is actually negative), however held memory is really high. What exactly is held memory? Is this the memory that is hanging around that is causing the the out of memory exception?

I have attached screenshots of the memory overview.


memory usage sorted on Held.PNG

Andreas Suurkuusk
Posts: 1030
Joined: Wed Mar 02, 2005 7:53 pm

Re: looking for memory leak

Post by Andreas Suurkuusk » Mon Jun 17, 2013 6:21 am

There's nothing in the screenshot that indicates a memory leak. The total number of bytes used by managed instances is about 20MB, which should be far from an out-of-memory problem. Held memory is memory that is kept in memory by an instance or a set of instances. It is part of the memory used by the live instances. For more information about held instances, see the online documentation.

In your case, something else happens when you run the second large report. Maybe you are mistakenly allocating a single very large array (e.g. > 2GB). This a a common mistake that will throw an OutOfMemoryException directly without any indication of growing memory usage. Otherwise you should be able to see the increase in memory usage by using the real-time view or by collecting a peak snapshot.
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests