Use of "Graph and statistics" view

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
Posts: 8
Joined: Thu Oct 02, 2008 7:44 am

Use of "Graph and statistics" view

Post by sthiers » Thu Oct 02, 2008 7:58 am


I would like to monitor the # of instances of a given .NET class present in memory over time, excluding instances which have been disposed.

It seems to me that the # I'm looking for is obtained by subtracting the "disposed instances" count to the "live instances" count.

As I always used to have a very ergonomic and practical experience of MemProfiler, I wonder, if this un-practical subtraction is correct.

At first sight, I thought that the "Live instances" count would do the job as it occurs after GC collection. But in this case it should be equal to the sum of "disposed + undisposed" instances, which is not the case !
(my undisposed count remains to zero)

Thank you

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

Post by Andreas Suurkuusk » Thu Oct 02, 2008 9:07 pm

"Disposed instances" and "Undisposed instances" represent different types of counts. A disposed instance is a live instance whose Dispose method has been invoked. Therefore the Disposed instances count is part of the live instances count.

On the other hand, an undisposed instance is an instance whose Dispose method has not been called before it was GCed or finalized. The "Undisposed instances" count is an accumulative value of all instances that have been GCed or finalized without being disposed.

It's possible to investigate a specific disposed instance in a snapshot, since it's an existing instance. Specific undisposed instances cannot be investigated, since they normally no longer exist at the time of the snapshot. To get more information about undisposed instances, the allocation call stacks can be investigated.
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests