3

I have a form which doesn't free resources when closed. With what tool I can inspect what's happening ?

Dimitar Tsonev
  • 3,711
  • 5
  • 40
  • 70
  • Take a look at this question: http://stackoverflow.com/questions/3927/what-are-some-good-net-profilers – Florian Sep 26 '12 at 07:19

1 Answers1

4

There is a built-in profiler in VS2012 (may depend on which version of VS2012). Microsoft also has a free CLR Profiler for .NET 4

Red Gate makes an excellent memory profiler, which I find easier to use than the above alternatives, but it isn't free. There is a fully functional free trial that you can use to solve your problem.

Regarding your problem: the usual leak problem with forms are event handlers. Make sure you don't have any event handlers in the form that are coupled to a central class that isn't disposed.

There are also a few annoying bugs in the framework that attach central windows events such as "ui theme changed" to static fields in framework classes. This can for example result in classes hosting a windows forms toolbar never being garbage collected. Event handler leaks are tricky to find, so tricky that they even still exist in the framework code apparently.

Anders Forsgren
  • 10,827
  • 4
  • 40
  • 77