views:

235

answers:

3

After running some hours my application fails in creating a new font object:

CreateFontIndirect() returns NULL.

I know how to find memory leaks (i.e. using parallel inspector or another profiler - most of them include leak detection). But how can i locate a ressource leak in Win32?

+4  A: 

It looks like the MSDN article Resource Leaks: Detecting, Locating, and Repairing Your Leaky GDI Code might provide you with an answer.

Kevin
Well the article is good. But the tool mentioned is not linked - i cant find it anywhere.
RED SOFT ADAIR
+3  A: 

If you have BoundsChecker, it tracks resource leaks in addition to memory leaks.

Soo Wei Tan
Thanks for the tip - i have BoundsChecker and it once was the best tool ever. The quality though continuously decreased since our first license (about 15 Years ago), most specifically, since compuware acquired BoundsChecker. It just terminates immediately after start and recently it stopped my whole x64 System. Compuware DevPartner (the successor of BoundsChecker) is by the way still unable to analyze 64-Bit software.
RED SOFT ADAIR
+2  A: 

Grab yourself a copy of GDI View - this useful tool can show all the GDI objects used by your app, including details on the font name, size, etc. This has proved very handy in the past.

For Win32 apps you might want to look at the WTL framework - this wraps GDI objects with lightweight C++ classes that will handle object deletion for you.

Rob
Yes, this seems a very good tool. Amazingly tiny. A zip of only 50kB. Thanks.
RED SOFT ADAIR