[
https://issues.apache.org/jira/browse/AMQCPP-592?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16246384#comment-16246384
]
Francois Godin commented on AMQCPP-592:
---------------------------------------
Duplicate of https://issues.apache.org/jira/browse/AMQCPP-560 ??
> memory and handle leak of session
> ----------------------------------
>
> Key: AMQCPP-592
> URL: https://issues.apache.org/jira/browse/AMQCPP-592
> Project: ActiveMQ C++ Client
> Issue Type: Bug
> Components: CMS Impl
> Affects Versions: 3.9.1
> Environment: IDE is VS2008 and OS is win7
> boost is 1.58.0
> Reporter: jerrytan
> Assignee: Timothy Bish
> Priority: Critical
>
> if we keep creating one thread and then create one session ( all sessions
> share a common connnection ) , then close session and thread ; the
> memory and handle is leak, and eventually causing an ugly crash
> statistical information : from 8:00 am to 14:00 pm
> memory / handle is begin with(1,612k/ 161) end with (22,300k/ 11,218)
> here is my code:
> =================================
> #include<cms/Connection.h>
> #include<boost/shared_ptr.hpp>
> #include<cms/ConnectionFactory.h>
> #include<winsock.h>
> #include<boost/thread/thread.hpp>
> #include<activemq/library/ActiveMQCPP.h>
> #Include<iostream>
> using boost::shared_ptr
> using namespace cms;
> using namespace std;
> void fun(Connection* conn)
> {
> // == create session==
> Session* session = conn->createSession(Session::AUTO_ACKNOWLEDGE);
> //== close session==
> session->close();
> delete session;
> Sleep(500);
> }
> int main()
> {
> activemq::library::ActiveMQCPP::initializeLibrary();
> ConnectionFactory* connectionFactory =
> ConnectionFactory::createCMSConnectionFactory("failover:(tcp://127.0.0.1:61616)");
> Connection* connection = connectionFactory->createConnection();
> connection->start();
> while(1)
> {
> boost::thread Thread(fun, connection); //== share common connection
> Thread.join();
> }
> }
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)