Fog Creek Software
Discussion Board

Hunting a .NET Memory Leak

Does anyone have any reccomendations for tools or techniques to hunt down a memory leak in a .NET WinForms app?

As every form is opened and closed we see the momory usage drive up and up. Calling a Garbage Collection doens't help, so I need to find the open objects.



Friday, August 1, 2003

Automated QA has a profiler that should help out: AQtime .NET Edition

FYI, I've never used the .NET edition, but the normal Delphi variant works pretty good.

Friday, August 1, 2003

How do you get a memory leak in a GC language?

Friday, August 1, 2003

It's probably not a C++ style memory leak. The objects in question are probably still referenced from SOMEWHERE. The problem is that somewhere can be fairly obscure.

For example, it could be in a form's Controls collection.

It could be a set of delegates registered on events that aren't being fired anymore.

Could be lots of places.

Chris Tavares
Friday, August 1, 2003

Oh.  That really sucks. :>(

Friday, August 1, 2003

Conclusion: .NET and other garbage collected languages still require you to track memory allocation. There's no substitute for good programming! LOL

Aaron Lawrence
Friday, August 1, 2003

Of course, but these appear to be coming from third-party components. I hunted down one that was leaking 3-7mb each time a form was closed.

Friday, August 1, 2003

Hope this helps.  Tell us what you think of it if you use it.

saint chad
Friday, August 1, 2003

Are you calling .Dispose() (or .Close()) on forms, etc., when they're not needed?

Robert Jacobson
Saturday, August 2, 2003

Shhhhh.  Be vewy vewy qwiet.  I hunting a dot net memowy weak

Saturday, August 2, 2003

*  Recent Topics

*  Fog Creek Home