[AGENT++] Thread handle leak (SNMP++ 3.2.21a)

Stoyan Haralampiev tony at gyuvetch.bg
Fri Jan 19 16:32:00 CET 2007


Hi,

It turned out that the same piece of code causes a memory leak under Linux too.
The reason is that taskDelete()
is not called (in stop_poll_thread()) for the thread created by taskSpawn() (in start_poll_thread()).

Here's some info on taskSpawn/Delete
-  http://www.slac.stanford.edu/exp/glast/flight/docs/VxWorks/docs/vxworks/ref/taskLib.html#taskDelete 

Best regards,
Tony

>-------- Оригинално писмо --------
>От: Stoyan Haralampiev  
>Относно: Re: Re: [AGENT++] Thread handle leak (SNMP++ 3.2.21a)
>До: Jochen Katz  
>Изпратено на: Сряда, 2007, Януари 17 15:25:15 GMT+02:00
>----------------------------------
>
>Thanks, Jochen!
>
>Best regards and good luck,
>Tony
>
>
>
>>-------- Оригинално писмо --------
>>От: Jochen Katz 
>>Относно: Re: [AGENT++] Thread handle leak (SNMP++ 3.2.21a)
>>До: agentpp at agentpp.org
>>Изпратено на: Сряда, 2007, Януари 17 00:31:38 GMT+02:00
>>----------------------------------
>>
>>Hi,
>>
>>> SNMP++ seems to cause handle leakage under Win32 because the thread
>>> handle m_hThread that is assigned inside Snmp::start_poll_thread() is
>>> not closed via a call to CloseHandle() in Snmp::stop_poll_thread().
>>> 
>>> Could you, please, confirm this one and eventually give some info
>>> when it could get patched?
>>
>>it can be patched immediately ;-)
>>
>>Just change stop_poll_thread() to;
>>#ifdef WIN32
>> ::WaitForSingleObject(m_hThread, INFINITE);
>> CloseHandle(m_hThread);
>>#elif defined (CPU) && CPU == PPC603
>>
>>This will be in the next release.
>>
>>A funny thing: If you don't need the handle after the thread is started,
>>you can write code like this:
>>CloseHandle(CreateThread(NULL,0, ThreadA,NULL,0,NULL));
>>
>>
>>Regards,
>> Jochen
>>_______________________________________________
>>AGENTPP mailing list
>>AGENTPP at agentpp.org
>>http://lists.agentpp.org/mailman/listinfo/agentpp
>>
>
>-----------------------------------------------------------------
>Заложете на късмета си със Спортингбет!
>_______________________________________________
>AGENTPP mailing list
>AGENTPP at agentpp.org
>http://lists.agentpp.org/mailman/listinfo/agentpp
> 

-----------------------------------------------------------------
Заложете на късмета си със Спортингбет!


More information about the AGENTPP mailing list