Application.Forms holding forms from releasing

Memory profiling for .NET developers

Moderators: Luke Jefferson, StephenC, AndrewH, melvyn.harbour, james.billings, Laura Morley, dene.boulton

Application.Forms holding forms from releasing

Postby Aravindan » Thu Feb 10, 2011 7:24 am

I am running into an issue with the winforms getting cleared.

I have a custom base form inheriting from System.Windows.Forms.Form. All the forms that i create are inheriting from my custom base form. After profiling my application for memory leaks i find that some of the pop-ups are not getting released. These pop-ups are still held in memory because of Application.Forms. How should this be cleaned up?

Thanks in advance.
Aravindan
 
Posts: 1
Joined: Thu Feb 10, 2011 7:15 am

Postby melvyn.harbour » Thu Feb 10, 2011 10:54 am

I suggest that you examine one of the instances (forms) using the Instance Retention Graph:

http://www.red-gate.com/supportcenter/C ... 286233.htm

You then need to examine the path to GC root to determine where a reference is being held incorrectly. Commonly this could be something like you forgetting to release a reference to the form in an event handler. If you break the references, garbage collection should then be able to take care of the rest.

Mel
Melvyn Harbour
Project Manager
.NET Tools Division
melvyn.harbour
 
Posts: 27
Joined: Mon Mar 15, 2010 3:27 pm


Return to ANTS Memory Profiler 7

Who is online

Users browsing this forum: No registered users and 0 guests