Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I find resource leaks in Win32?

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 resource leak in Win32?

like image 728
RED SOFT ADAIR Avatar asked Dec 08 '22 06:12

RED SOFT ADAIR


1 Answers

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.

like image 164
Rob Avatar answered Dec 09 '22 20:12

Rob