Winforms app - classes not getting GCd

Code and memory profiling for .NET developers.

Moderators: Brian Donahue, richardjm, StephenC

Winforms app - classes not getting GCd

Postby mnadig » Tue Apr 28, 2009 5:02 pm

In my winforms application, each "form" is actually a usercontrol that is placed in a panel. When the user selects a menu item, the current "form" is removed from the panel and explicitly disposed before newing up the next usercontrol and adding it to the panel's controls collection. Using memory profiling, I see that some of my "forms" aren't going away after calling dispose(). I click GC now and take a snapshot and see that they're still listed in live objects. How can I determine what is preventing it from GC?

thank you
mnadig
 
Posts: 4
Joined: Tue Apr 28, 2009 4:43 pm

Postby StephenC » Tue Apr 28, 2009 6:22 pm

Hi,

the easiest way would be to try the upcoming V5 which has an 'Object Retention Graph' showing you which other objects are still holding references to an instance you are interested in and therefore preventing garbage collection.

You can try the early access build from here:
http://www.red-gate.com/messageboard/viewforum.php?f=92

There are a set of filters available which you will find very helpful by the sounds of it. One of them checks for objects where Dispose was called but the object is still in memory.

Feedback is very much appreciated on this early access version of V5 if you can spare a few minutes when finished profiling.

Regards,

Stephen
StephenC
 
Posts: 306
Joined: Mon Oct 15, 2007 9:18 am
Location: Cambridge

Postby mnadig » Tue Apr 28, 2009 8:08 pm

Thank you for the quick reply. Downloaded and just watched Part 1 on the How to with v5 videos on youtube (in 2 parts). I'm looking forward to Part 2. Meanwhile, I'll give it a go and provide feedback.
mnadig
 
Posts: 4
Joined: Tue Apr 28, 2009 4:43 pm


Return to ANTS Profiler Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests