activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Posta (JIRA)" <>
Subject [jira] [Commented] (AMQ-4715) Memory issue with ActiveMQ in java
Date Tue, 10 Sep 2013 20:29:52 GMT


Christian Posta commented on AMQ-4715:

the correct approach would be to profile your app with yourkit or visualvm or some java profiler
as Tim recommended. you have not demonstrated a memory issue with what you've presented thus

again, as Tim pointed out, garbage collection has its own algorithms for initiating and reclaiming
whatever objects are unreachable. if you use a jvm profiling tool, you'll be able to see what
objects are live, which are unreachable (and would be gc'd) and can even force the GC to happen.

you should investigate further what your code is doing and what memory characteristics you're
experiencing and post those results here if there is an apparent problem. additionally, this
sort of discussion should be happening on the mailing list, not this JIRA issue. 

i suggest we close this and continue discussion on mailing list and reopen this if there is
conclusive issue to be found. 

> Memory issue with ActiveMQ in java
> ----------------------------------
>                 Key: AMQ-4715
>                 URL:
>             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:

View raw message