activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mill888 <>
Subject I found Activemq-cpp can not be used like this, otherwise memory leak
Date Mon, 25 Feb 2019 09:38:12 GMT
     If you want to use activemq-cpp in multi thread , then you have to
create thread using  the class Thread(in the file Thread.cpp), and you can
not create thread  by pthread_create youself, because  activemq-cpp uses the
function "synchronized" in many places, and in the "synchronized" function ,
it would create some values in the memory. So if you do not use the class
Thread, then this values would not be released when the thread exit;

    But in real world, this is not what the developer want, and the class
Thread is not suitable in some scenes,  so they always want to create
pthread_create theyself。This would result to memory leak;

    For example, In the thead, we want to dispose thread firstly, then send
to activemq using Activemq-cpp producer.

    So I write a simple code named test6.cpp, anyone can test it. This
problem is very serious, and the activemq-cpp would be not useful nearly。

test6.cpp <>  

Sent from:

View raw message