You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "ritesh (JIRA)" <ji...@apache.org> on 2013/09/09 23:30:51 UTC

[jira] [Created] (AMQ-4715) Memory issue with ActiveMQ in java

ritesh created AMQ-4715:
---------------------------

             Summary: Memory issue with ActiveMQ in java
                 Key: AMQ-4715
                 URL: https://issues.apache.org/jira/browse/AMQ-4715
             Project: ActiveMQ
          Issue Type: Bug
    Affects Versions: 5.7.0, 5.6.0
            Reporter: ritesh


Every time when i start connection and create session i can see “java.exe” (in task manger) memory get increase by 1000 to 2000K that’s ok.
Now, when i closed connection and session expecting to memory  go down by 1000 to 2000K but nothing happening.

Here is my sample code.

public static void main(String[] args)
{
      try
      {
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616");
Connection connection= connectionFactory.createConnection();
connection.start();          


for(int i=0;i<40;i++)
{


Session	session=  m_connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);

Destination queueDestination = session.createQueue("TestQueue");

MessageProducer producer = session.createProducer(queueDestination);
producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);

TextMessage 	textMessage = session.createTextMessage();
textMessage.setText(“some text”);

String jmsCorrelationId= UUID.randomUUID().toString();
textMessage.setJMSCorrelationID(m_jmsCorrelationId);

producer.send(textMessage);

if(!producer.equals(null))
{
producer.close();
             producer=null;
}
if(!m_session.equals(null))
{
                session.close();
                ession=null;
}


} // end for loop

if(connection!=null)
{
              connection.close();

}
 }

If you will execute this program three to four time you will see significant memory get increase in task manger for “java.exe”.
Thing most bothering me is that… after executing this program all allocated memory should get cleaned-up by GC but look like somehow it’s not happening.

No idea what am I doing wrong?

Please help me!


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira