|
-
December 2nd, 2004, 09:24 AM
#1
Using the Windows Task Manager
Hi Folks,
I am trying to debug a VC++ implemented application which I believe is leaking Handles (specifically Win32 Events). I am using Process Explorer and Windows Task Manager to identify and count the Event handles.
My problem is that the number of Event handles I see displayed within Task Manager and Process Explorer is a lot more than the Events actually created programmatically within the application code.
Does anyone know where these extra Event handles are coming from ? Process Explorer actually lists these extra handles as "unnamed".
Thanks in advance for your help.
Avayi.
-
December 2nd, 2004, 03:45 PM
#2
Re: Using the Windows Task Manager
Windows creates those handles while running your program. You are right, they probably aren't handles your application created. Why do you think you are leaking handles ?
-
December 3rd, 2004, 03:52 AM
#3
Re: Using the Windows Task Manager
I suspect a handle leak because when ever I keep the application (a modem handler by the way) running for a long time, the handle count increases progressively.
When I first start the application, the handle count is 53. When I use it to drive the modem by making a request to the modem, the handle count goes up to 58. This I can perfectly understand.
But when I terminate the request, and bring the application back to its original (i.e non-requesting) state, I expect (maybe naively) the handle count to drop back to 53. Instead, the handle count drops to 54. This "quiescent" handle count increases progressively after completing subsequent modem requests.
-
December 3rd, 2004, 01:41 PM
#4
Re: Using the Windows Task Manager
 Originally Posted by Avayi
But when I terminate the request
How are you terminating the request? Are you closing the handles properly? Are you calling appropriate cancel functions or just terminating a thread?
Arjay
-
December 4th, 2004, 09:38 AM
#5
Re: Using the Windows Task Manager
 Originally Posted by Arjay
How are you terminating the request? Are you closing the handles properly? Are you calling appropriate cancel functions or just terminating a thread?
Arjay
I think I am closing the threads correctly. I terminate the request using CloseHandle(), and setting the handle to NULL immeadiately afterwards.
-
December 6th, 2004, 01:43 PM
#6
Re: Using the Windows Task Manager
 Originally Posted by Avayi
I think I am closing the threads correctly. I terminate the request using CloseHandle(), and setting the handle to NULL immeadiately afterwards.
Um, there may be some confusion here. If you are using CloseHandle() on a thread, this won't make the thread finish. It just releases the handle so you can't use that handle anymore to suspend the thread or check its exit status. Understand that the thread will continue to operate unless you reach the end of the thread or you explicitly return early.
On the other hand, "I terminate the request using CloseHandle()...". Are you referring to a Win32 operation? If so, are you sure this is the correct way to cancel this operation? If not, this could be the source of the leak.
Arjay
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|