Detect windowhandle leaks in a c# application-Collection of common programming errors

Any decent memory profiler will show you the control instances. They won’t be garbage collected, their Handle property keeps them alive. There will be close to 10,000 of them.

A code review ought to go a long way too, there are not that many possible ways to leak a window. Look for code that calls Controls.Remove() but don’t explicitly dispose the control. Or a form displayed with ShowDialog() that doesn’t get disposed and forgets to unregister a static event handler (SystemEvents e.g.)

Finding the handles yourself at runtime is technically possible with Reflection. The handles are stored in System.Internal.HandleCollector.handleTypes[]. Well, technically.