[prev in list] [next in list] [prev in thread] [next in thread]
List: activemq-dev
Subject: I found Activemq-cpp can not be used like this, otherwise memory leak
From: mill888 <185308105 () qq ! com>
Date: 2019-02-25 9:38:12
Message-ID: 1551087492813-0.post () n4 ! nabble ! com
[Download RAW message or body]
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic