activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris W. (JIRA)" <j...@apache.org>
Subject [jira] Created: (AMQCPP-289) decaf.lang.Thread doesn't free memory when phtreads used
Date Fri, 26 Feb 2010 14:48:40 GMT
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 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.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message