views:

275

answers:

5

what is the best way to track and lower GDI windows handles . .

+1  A: 

Personally I use IARSN TaskInfo to see the number of handles my program uses, GDI included. As for lowering the number of active handles, then I would look at what in your application is using handles.

Things like (but not limited to):

  • Pens
  • Bitmaps
  • Controls (I don't think all of them uses handles)

Do you have a specific problem with too many handles, or perhaps even a handle leak?

Lasse V. Karlsen
i think so but i am trying to determine how to diagnose this and isolate how to fix this
ooo
A: 

the easiest way to see the current usage on an end user's machine is to use task manager and look at the column "GDI Handles"

When I suspect I have GDI handle leaks I tend to run through my leak scenario once, force a garbage collection, look at task manager, run the action again with gc and check for a difference. If I find one I have used the .Net Profiler (from SciTech) which can show in detail which object causes the leak and why it is not handed back

Oskar
+1  A: 

You don't need any tool. Just read GDI handle table with win32 api

how would you do this . .would this tell you where the handles are coming from?
ooo
+1  A: