Desert Ice
Desert Ice

Reputation: 4600

Getting the number of handle open per thread

I fear that my component is leaking handles.

I see that the number of handles is increasing gradually

Using handle utility i was able to find out the number of handles and the type of each handle. It appears i am somehow leaking Event Handles. I don't create events at all. Maybe something underlying is causing event handles to be leaked. To narrow my search, i wanted to get the number of handles opened by each thread.

I also tried windbg htrace(snapshot and diff). Was not able to get much information about my threads. Are there any utilities that can give me information

  1. Per thread or
  2. Name of the handles open

Upvotes: 0

Views: 286

Answers (1)

Hans Passant
Hans Passant

Reputation: 942000

No, event handles are not associated with a thread at all. And they won't typically have a name, it is only used when they need to be shared across processes.

Consider setting a breakpoint on CreateEvent() so you'll at least have an idea where to start looking. Debug + New Breakpoint + Break at Function. Type __imp__CreateEventW@16 for the function name. Just in case, also add a breakpoint for the A version. Or catch them all with _NtCreateEvent@20, debugging symbols required.

Upvotes: 3

Related Questions