You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by mill888 <18...@qq.com> on 2019/02/25 09:38:12 UTC

I found Activemq-cpp can not be used like this, otherwise memory leak

Hello:
     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 <http://activemq.2283324.n4.nabble.com/file/t379406/test6.cpp>  



--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-Dev-f2368404.html