Reputation: 3882
I have a form which doesn't free resources when closed. With what tool I can inspect what's happening ?
Upvotes: 3
Views: 5171
Reputation: 11101
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.
Upvotes: 4