4 Replies Latest reply on Aug 9, 2004 6:09 PM by benstarr

    Memory problem when sending large number of messages

    benstarr Newbie

      I have a complex J2EE application which uses JMS quite a lot. There is a batch process which it runs overnight which is causing a memory leak. Each morning the server has used more and more memory and eventually it will run out of memory. The memory is never reclaimed by the JVM.

      I think I have isolated the problem to a part of the batch process which sends a large number of messages. The pesudo code is something like the following:

      1. Lookup queue connection factory
      2. Create queue connection
      3. Lookup queue
      4. Create queue session
      5. Create queue sender
      6. Send 1,000s of messages using the queue sender
      7. Close the queue connection

      This all occurrs within an MDBs onMessage method. Each message is a map message and I am reusing the same message object each time by calling message.clearBody after each call.

      I am running JBoss 3.2.3 on Mac OS 10.3 Server (Java 1.4.2) and am using an Oracle database for message persistence. I am using JMS in many other parts of the application but generally only sending one message at a time. Any help in identifying the possible cause of the memory leak would be much appreciated.