Search code examples
.netwinformsgdi

How to debug GDI Object Leaks?


I'm not quite sure how to go about doing this. It is a large app, and we are having GDI object "leaks" on most of our forms.

Is there a tool to help out? Is there a tutorial on how to use such a tool?

Should I just start deleting code from our forms until I narrow the offender down? (there is ALOT of code).


Solution

  • Turns out that I just used Task Manager and tried reproducing the problem. Our issue with our app (and the GDI object leak) was that we were using a static object and binding to it. There was/is a bug with .net 3.5 (atleast) where the form when closing will not know how to dispose of everything correctly and certain graphic object will remain in memory.