handle leaks..?
From: vinod kumar (naga_vinod_at_yahoo.com)
Date: 03/02/04
- Next message: Bonj: "LONGLONG"
- Previous message: Martin Wartens: "Re: template specialization bug"
- Next in thread: vinod kumar: "Re: handle leaks..?"
- Reply: vinod kumar: "Re: handle leaks..?"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 2 Mar 2004 13:03:47 +0530
Hi all,
It works fine on XP Professional but not on WinNT 4.0 and Win2k.
While PrivateBytes, VirtualBytes,etc doing very fine I see Handle count keep
going
up in the Task Manger and PerfMon.
Its about handle leaks but I wonder if anything special about winnt 4.0 and
win2k. In the
NT Service I'm creating threads in a loop, threads return fine and I do
close handles using CloseHandle() in a loop. And the return value of
CloseHandle() for all the handles looks fine (as viewed using
OutputDebugString() in the debugger and WaitForMultipleObjects always is
WAIT_OBJECT_0)
for(i = 0;i<z;i++)
{
array[i] = CreateThread(0,
0, // use default stack size
(LPTHREAD_START_ROUTINE) ThreadProc, // thread function
NULL, // argument to thread function
0, // use default creation flags
&dwThreadID);
}
DWORD waitfor = WaitForMultipleObjects(noofprocess,hThread,TRUE,freq);
int relhandles = 0;
switch(waitfor)
{
char clip[512];
BOOL close;
case WAIT_TIMEOUT:
OutputDebugString(_T(" WAIT_TIMEOUT"));
for(relhandles = 0; relhandles < curIns; relhandles++)
{
if(hThread[relhandles] !=0)
{
close = CloseHandle(hThread[relhandles]);
if(close != 0)
{
sprintf(clip,_T("\n Handle %d closed \n"),relhandles);
OutputDebugString(clip);
}
else
{
sprintf(clip,_T("\n Close Handle %d failed \n"),relhandles);
OutputDebugString(clip);
_Module.LogEvent(_T(clip));
}
}
}
break;
case WAIT_ABANDONED_0:
OutputDebugString(_T("WAIT_ABANDONED"));
break;
case WAIT_OBJECT_0:
OutputDebugString(_T("WAIT_OBJECT_0"));
for(relhandles = 0; relhandles < curIns; relhandles++)
{
if(hThread[relhandles] !=0)
{
close = CloseHandle(hThread[relhandles]);
if(close != 0)
{
sprintf(clip,_T("\n Handle %d closed \n"),relhandles);
OutputDebugString(clip);
}
else
{
sprintf(clip,_T("\n Close Handle %d failed \n"),relhandles);
OutputDebugString(clip);
_Module.LogEvent(_T(clip));
}
}
}
break;
default:
OutputDebugString(_T("default"));
}
thank you,
vinod
- Next message: Bonj: "LONGLONG"
- Previous message: Martin Wartens: "Re: template specialization bug"
- Next in thread: vinod kumar: "Re: handle leaks..?"
- Reply: vinod kumar: "Re: handle leaks..?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|