[prev in list] [next in list] [prev in thread] [next in thread]
List: activemq-dev
Subject: [jira] Updated: (AMQCPP-289) decaf.lang.Thread doesn't free memory
From: "Chris W. (JIRA)" <jira () apache ! org>
Date: 2010-02-26 14:52:40
Message-ID: 368805079.12571267195960746.JavaMail.jira () brutus ! apache ! org
[Download RAW message or body]
[ https://issues.apache.org/activemq/browse/AMQCPP-289?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel \
]
Chris W. updated AMQCPP-289:
----------------------------
Description:
If you run the following program:
int main (int argc, char *argv[])
{
ConnectionFactory* connectionFactory;
Connection *connection;
activemq::library::ActiveMQCPP::initializeLibrary();
std::string brokerURI =
"tcp://127.1.0.1:61616"
"?wireFormat=openwire";
connectionFactory = ConnectionFactory::createCMSConnectionFactory( brokerURI );
for (int i=0;i<1000;i++)
{
connection = connectionFactory->createConnection();
connection->start();
connection->stop();
connection->close();
delete connection;
printf("Count %ld\r\n",i);
}
delete connectionFactory;
activemq::library::ActiveMQCPP::shutdownLibrary();
return 0;
}
the consumption of memory grows on every new connection, but the memory is never \
freed. After about 180 connections the maximum virtual memory (about 3GB on 32bit \
Linux) of the process is reached and its impossible to create a new thread for the \
client. I saw that the destructor of the Thread class is called, but the memory of \
the created threads is not freed.
If I add the line:
#ifdef HAVE_PTHREAD_H
pthread_detach(properties->handle);
#endif
to the destructor of de decaf/ang/Thread class the memory is freed after destroying \
the connection.
This is a quick and dirty fix, but I think somewhat is going wrong here.
was:
If you run the following program:
int main (int argc, char *argv[])
{
ConnectionFactory* connectionFactory;
Connection *connection;
activemq::library::ActiveMQCPP::initializeLibrary();
std::string brokerURI =
"tcp://127.1.0.1:61616"
"?wireFormat=openwire";
connectionFactory = ConnectionFactory::createCMSConnectionFactory( brokerURI );
for (int i=0;i<1000;i++)
{
connection = connectionFactory->createConnection();
connection->start();
connection->stop();
connection->close();
delete connection;
printf("Count %ld\r\n",i);
}
delete connectionFactory;
activemq::library::ActiveMQCPP::shutdownLibrary();
return 0;
}
the consumption of memory grows on each new connection, but the memory is never \
freed. After about 180 connections the maximum virtual memory (about 3GB on 32bit \
Linux) of the process is reached and its impossible to create a new thread for the \
client. I saw that the destructor of the Thread class is called, but the memory of \
the created threads is not freed.
If I add the line:
#ifdef HAVE_PTHREAD_H
pthread_detach(properties->handle);
#endif
to the destructor of de decaf/ang/Thread class the memory is freed after destroying \
the connection.
This is a quick and dirty fix, but I think somewhat is going wrong here.
> decaf.lang.Thread doesn't free memory when phtreads used
> --------------------------------------------------------
>
> Key: AMQCPP-289
> URL: https://issues.apache.org/activemq/browse/AMQCPP-289
> Project: ActiveMQ C++ Client
> Issue Type: Bug
> Components: Decaf
> Affects Versions: 3.1
> Environment: Linux Ubuntu 9.10
> Reporter: Chris W.
> Assignee: Timothy Bish
>
> If you run the following program:
> int main (int argc, char *argv[])
> {
>
> ConnectionFactory* connectionFactory;
> Connection *connection;
> activemq::library::ActiveMQCPP::initializeLibrary();
>
> std::string brokerURI =
> "tcp://127.1.0.1:61616"
> "?wireFormat=openwire";
>
> connectionFactory = ConnectionFactory::createCMSConnectionFactory( brokerURI );
> for (int i=0;i<1000;i++)
> {
> connection = connectionFactory->createConnection();
> connection->start();
> connection->stop();
> connection->close();
> delete connection;
> printf("Count %ld\r\n",i);
> }
>
> delete connectionFactory;
>
> activemq::library::ActiveMQCPP::shutdownLibrary();
> return 0;
> }
> the consumption of memory grows on every new connection, but the memory is never \
> freed. After about 180 connections the maximum virtual memory (about 3GB on 32bit \
> Linux) of the process is reached and its impossible to create a new thread for the \
> client. I saw that the destructor of the Thread class is called, but the memory of \
> the created threads is not freed.
> If I add the line:
> #ifdef HAVE_PTHREAD_H
> pthread_detach(properties->handle);
> #endif
> to the destructor of de decaf/ang/Thread class the memory is freed after destroying \
> the connection. This is a quick and dirty fix, but I think somewhat is going wrong \
> here.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic