I ran an overnight stress test of my application, and when i came in this morning the software had crashed from a Windows error.
The error occurred because the process was obviously out of GDI handles:
Process Explorer
Task Manager
The next thing is to figure out exactly which kind of GDI resource (e.g. Pen, Brush, Bitmap, Font, Region, DC) i'm leaking. For that i turned to NirSoft's GDIView:
What could a GDI handle be, one that is not any known GDI type?
You can usually spot this issue, besides your applications crashing, by opening up the Task Manager, going to the Details tab, right click the columns, and click “Select Columns”. From this list you should be able to choose GDI objects and view them in the new column.
The Graphics Device Interface (GDI) is a legacy component of Microsoft Windows responsible for representing graphical objects and transmitting them to output devices such as monitors and printers.
GDIView is a unique tool that displays the list of GDI handles (brushes, pens, fonts, bitmaps, and others) opened by every process. It displays the total count for each type of GDI handle, as well as detailed information about each handle.
The answer was GDI HFONT
handles.
It is a Windows 8 issue that GDIView cannot show the font handles.
I used hooking to intercept every call to:
and logged every handle creation, along with its stack trace of when it was allowed. At the end i created a report of all undeleted HFONT
s.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With