Jörgen Sigvardsson
Jörgen Sigvardsson

Reputation: 4897

GDI handle types

I'm currently trying to track down a GDI handle leak. I am currently using GDIView to track it down. The tool divides the GDI objects into categories Pen, ExtPen, Bitmap, Font, Palette, Region, DC, Metafile DC, Enhanced Metafile DC, and Other GDI. These categories are summed in a column called GDI Total. Ontop of that, there's a column called All GDI. It is in this column I am detecting the leak.

As I don't have the source code for the tool, I can't see what's really going on. Did the author of the tool miss a handle type? It looks like it. I do know there is a leak, because some users report that they are shown the infamous dialog A required resource was (end of text). It may take weeks for the dialog to show up, so I'm pretty sure it isn't a DC.

Any ideas on how to track this down would be much appreciated! As I have a limited budget, thousand dollar tools are out of the question. Debugging hooks into GDI would suffice, as I don't mind doing detective work.

Upvotes: 2

Views: 1070

Answers (2)

Jörgen Sigvardsson
Jörgen Sigvardsson

Reputation: 4897

I found the problem. Apparently, GDIView thinks that icons fall under the unknown category. The problem was an icon being loaded and attached to an object. The object was not setup to auto delete the icon upon destruction. E-mailing the author of said tool...

Upvotes: 2

sharptooth
sharptooth

Reputation: 170549

Once I had a similar problem and I used Task Manager - asked it to show GDI handles count for each process and stepped over the program code to see where the handles count unexpectedly increases and fails to decrease back. It took some time, but finally using divide-and-conquer I found the error.

Upvotes: 0

Related Questions