Is this a leak?

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
ajh
Posts: 2
Joined: Mon Apr 07, 2008 5:23 pm

Is this a leak?

Post by ajh » Mon Apr 07, 2008 5:39 pm

I am analyzing why a form that I open and close repeatedly causes memory usage to continually, jump. When I:
- Open it initially
- Take a snaphot
- Close it
- Take a snapshot
- Close it

and then look at the information with memory profiler, chosing 'Disposed Info', I get the following for the form:
(Live Instances)
Total:1
New:1
Removed:1
Delta:0
(Disposed Instances)
Total:1
New:1
Removed:0
Delta:1
(Undisposed instances)
Total:0
Delta:0

Is this an indication of a memory leak? What should the numbers be if there is no leak?

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

Post by Andreas Suurkuusk » Tue Apr 08, 2008 8:28 am

I'm not sure I understand how you open and close the form, and when the snapshots are created. From your description it seems like you closed the same form twice.

Anyway, the numbers you show does not indicate a growing memory leak. You have one instance that does not get collected, but it seems to be replaced with another instance when the second snapshot is collected. After the second snapshot, the new instance was disposed, which the original instance was not in the first snapshot.

As long as the delta value for Live instances is zero, you probably don't have a growing memory leak. If the Total instances count is greater than zero then you might have a "left over" memory leak. This is a minor memory leak that doesn't grow over time. If you open and close another form, the "left over" instance gets collected.
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests