I have a form which doesn’t free resources when closed. With what tool I can inspect what’s happening ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.