activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ritesh (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AMQ-4715) Memory issue with ActiveMQ in java
Date Tue, 10 Sep 2013 15:30:51 GMT

    [ https://issues.apache.org/jira/browse/AMQ-4715?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13763118#comment-13763118
] 

ritesh commented on AMQ-4715:
-----------------------------

Hi Timothy,

So this is what i did today, run same code with 10,000 request (instead of 40 in for loop)
and this is what i get.

Nothing was up on my machine just started activeMQ(5.7.0)  and looking @ task manager “java.exe”
was “137144K”
After run my code “java.exe” was “349808K” why is that? (waited for 30 minutes after
run my code)

Again, not blaming on activeMQ or anyone trying to figure out what am doing wrong that cause
an issue with memory.

Do i missing any configuration if so, could you please tell me where and why?

One more thing, in my original app i have singleton class where i do connection one time an
keep that connection object live until application shutdown.
I do create “session, destination, temporary queue, messageSelector” for every request
and close them after done with this request.

Order of closing all objects

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

            }
            if(m_objConsumer!=null)
            {
                m_objConsumer.close();
                m_objConsumer=null;
            }
            if(m_objSession!=null)
            {
                m_objSession.close();
                m_objSession=null;
            }

Thanks in advance.

                
> 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

Mime
View raw message