[ 
https://issues.apache.org/jira/browse/AMQ-4715?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Timothy Bish updated AMQ-4715:
------------------------------

    Description: 
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.

{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 != null) {
         producer.close();
         producer=null;
      }
      
      if(m_session != null) {
        session.close();
        session=null;
      }
    } // end for loop

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

If you will execute this program three to four times 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!


  was:
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.

{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();

}
 }
{code}

If you will execute this program three to four times 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!


    
> 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.6.0, 5.7.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.
> {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 != null) {
>          producer.close();
>          producer=null;
>       }
>       
>       if(m_session != null) {
>         session.close();
>         session=null;
>       }
>     } // end for loop
>     if (connection!=null) {
>       connection.close();
>     }
>   }
> }
> {code}
> If you will execute this program three to four times 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

Reply via email to