gdi and other handles leaks


When your application crashes it might be due to some severe GDI leaks. The windows XP registry sets a maximum limit for the GDI handles to be opened per session.
Gdi is the way graphical objects are represented in windows.
Detecting leaks can be done by means of a very efficient visual studio add-in "deleaker" and the freeware application GdiView. The add-in will point the exact place in code where the leak took place, namely the location of the unreleased handle location.
Gdi object in most cases will be assigned to a brush, a pen or a bitmap. To release the gdi object use the ::DeleteObject method.

Note:
Be carefull with the WTL headers, it has some internal leaks.

Post a Comment

Previous Post Next Post