On Fri, 2010-01-15 at 00:32 -0800, diedie wrote:
> Hi,
>
> I recently upgraded my cms library from 3.0 to 3.1(built using vs-2005),
> and face some issues that handle leaks when reconnecting to server.
>
> So I wrote a simple testing program based on vs2005-activemq-example,
> and found that it occurs even I just create the connection and close it.
> Has any one encountered this before?
> Or is there anything I should notice but missed?
>
> Any reply is appreciated.
>
>
> Here is the code I wrote for testing.
> ==============================
> while(true){
> ConnectionFactory* connectionFactory(
> ConnectionFactory::createCMSConnectionFactory(
> "tcp://127.0.0.1:61616" )
> );
>
> Connection* connection = connectionFactory->createConnection();
> connection->start();
> connection->close();
> delete connection;
> connection = NULL;
> delete connectionFactory;
> connectionFactory = NULL;
> Sleep(2000);
> }
> =============================
>
> And following are the reports generated using DebugDiag.
> It's strange that it leaks in different when I using different linking
> method.
>
> Static Linking case :
> Function msvcr80d!_beginthreadex+fd
> Allocation type Thread handle(s)
> Handle Count 816 handle(s)
> Leak Probability 100%
>
> Call stack sample 1
So far I have not found any leaks. Did your complete application
include code to initialize and shutdown the ActiveMQ-CPP library, its
not included in the snippet.
Regards
Tim.
>
> Handle 0x00001448 Allocation Time 00:05:26 since tracking started
> Function Source Destination
> msvcr80d!_beginthreadex+fd
> f:\dd\vctools\crt_bld\self_x86\crt\src\threadex.c @ 206
> kernel32!CreateThread
> vs2005_activemq_example!decaf::lang::Thread::start+13b
> e:\3rdparty\activemq\cms-3.1\activemq-cpp-library\src\main\decaf\lang\thread.cpp
> @ 378 msvcr80d!_beginthreadex
> msvcr80d!_free_dbg+5d f:\dd\vctools\crt_bld\self_x86\crt\src\dbgheap.c @
> 1222
> msvcr80d!operator delete+c6
> f:\dd\vctools\crt_bld\self_x86\crt\src\dbgdel.cpp @ 56
> vs2005_activemq_example!activemq::transport::IOTransport::start+1de
> e:\3rdparty\activemq\cms-3.1\activemq-cpp-library\src\main\activemq\transport\iotransport.cpp
> @ 166
> vs2005_activemq_example!activemq::transport::TransportFilter::start+53
> e:\3rdparty\activemq\cms-3.1\activemq-cpp-library\src\main\activemq\transport\transportfilter.cpp
> @ 90
> vs2005_activemq_example!activemq::transport::correlator::ResponseCorrelator::start+113
>
> e:\3rdparty\activemq\cms-3.1\activemq-cpp-library\src\main\activemq\transport\correlator\responsecorrelator.cpp
> @ 243
> vs2005_activemq_example!activemq::core::ActiveMQConnection::ActiveMQConnection+21b
>
> e:\3rdparty\activemq\cms-3.1\activemq-cpp-library\src\main\activemq\core\activemqconnection.cpp
> @ 80
> vs2005_activemq_example!activemq::core::ActiveMQConnectionFactory::createConnection+39c
>
> e:\3rdparty\activemq\cms-3.1\activemq-cpp-library\src\main\activemq\core\activemqconnectionfactory.cpp
> @ 143
> vs2005_activemq_example!main+14a
> e:\3rdparty\activemq\cms-3.1\activemq-cpp-library\src\examples\main.cpp @
> 397
> vs2005_activemq_example!mainCRTStartup+d
> f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c @ 414
> kernel32!BaseProcessStart+23
>
> Dynamic Linking case :
> Function
> libactivemq_cpp_31_vc80_mt_d!decaf::internal::util::concurrent::ConditionImpl::create+a5
>
> Allocation type Semaphore handle(s)
> Handle Count 2730 handle(s)
> Leak Probability 100%
>
> Call stack sample 1
>
> Handle 0x00000784
> Allocation Time 00:05:06 since tracking started
> Function Source Destination
> libactivemq_cpp_31_vc80_mt_d!decaf::internal::util::concurrent::ConditionImpl::create+a5
>
> e:\3rdparty\activemq\cms-3.1\activemq-cpp-library\src\main\decaf\internal\util\concurrent\windows\conditionimpl.cpp
> @ 47 kernel32!CreateSemaphoreA
> libactivemq_cpp_31_vc80_mt_d!activemq::transport::tcp::TcpTransport::initialize+452
>
> e:\3rdparty\activemq\cms-3.1\activemq-cpp-library\src\main\activemq\transport\tcp\tcptransport.cpp
> @ 129
> libactivemq_cpp_31_vc80_mt_d!activemq::transport::tcp::TcpTransportFactory::doCreateComposite+12d
>
> e:\3rdparty\activemq\cms-3.1\activemq-cpp-library\src\main\activemq\transport\tcp\tcptransportfactory.cpp
> @ 99
> libactivemq_cpp_31_vc80_mt_d!activemq::transport::tcp::TcpTransportFactory::create+c1
>
> e:\3rdparty\activemq\cms-3.1\activemq-cpp-library\src\main\activemq\transport\tcp\tcptransportfactory.cpp
> @ 53
> libactivemq_cpp_31_vc80_mt_d!activemq::core::ActiveMQConnectionFactory::createConnection+2df
>
> e:\3rdparty\activemq\cms-3.1\activemq-cpp-library\src\main\activemq\core\activemqconnectionfactory.cpp
> @ 133
> vs2005_activemq_example!main+168
> e:\3rdparty\activemq\cms-3.1\activemq-cpp-library\src\examples\main.cpp @
> 397
> vs2005_activemq_example!mainCRTStartup+d
> f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c @ 414
> kernel32!BaseProcessStart+23
>
--
Tim Bish
http://fusesource.com
http://timbish.blogspot.com/