0

I've made a test, based on the example solution of the activemq-cpp library. In the test I send 50,000 messages to a queue, and after they're all sent I consume them, with INDIVIDUAL_ACKNOWLEDGE on the session and message->acknowledge() on every consumed message. The consumer is asynchronous.

Memory (private working set) of java.exe before sending messages: 209,320 KB. After sending all messages: 412,548 KB. After consuming all messages: 434,637 KB. Meaning, although queue size is 0, memory was not released. What am I missing? Thanks.

Ofer B
  • 117
  • 1
  • 12
  • From http://stackoverflow.com/questions/16649601/java-exe-process-uses-more-memory-and-does-not-free-it-up : `JVM acquires memory when it needs to execute some complex logic. When java is done processing the tasks the JVM will still keep that memory as a reserved space and is not released back to the OS. This architecture helps in performance because JMV does not have to request the same memory again from the underlying OS. It will still be within the range you define in -Xmx JVM parameter. ` - ie, that behavior is normal. – fvu Aug 07 '13 at 15:05

1 Answers1

2

Besides the JVM processing mentioned above there are a number of other factors that are in play here. Depending on the state of the broker when you started the producer sending messages there could be a number of resources that where allocated on the broker to create the Queue and various other management objects which will then remain in memory to facilitate message routing etc. To truly analyze the memory usage and check for leaks you should use a tool like Yourkit etc.

Tim Bish
  • 17,475
  • 4
  • 32
  • 42