Snippets
(Unterschied zwischen Versionen)
(Die Seite wurde neu angelegt: „<pre> class DbgGuiLeak { public: DbgGuiLeak () { _guiResCount = ::GetGuiResources (::GetCurrentProcess (), …“) |
|||
Zeile 1: | Zeile 1: | ||
+ | = Finding GDI Leaks by counting GDI objects = | ||
<pre> | <pre> | ||
class DbgGuiLeak | class DbgGuiLeak |
Version vom 07:50, 25. Sep. 2009
Finding GDI Leaks by counting GDI objects
class DbgGuiLeak { public: DbgGuiLeak () { _guiResCount = ::GetGuiResources (::GetCurrentProcess (), GR_GDIOBJECTS); } ~DbgGuiLeak () { int leaks = ::GetGuiResources (::GetCurrentProcess (), GR_GDIOBJECTS) - _guiResCount; if (leaks != 0) { std::cout << "Gui Resources Leaked: " << leaks << std::endl; } } private: unsigned _guiResCount; };