[rabbitmq-discuss] Rabbitmq Java Client Memory Leak?

Matthias Radestock matthias at rabbitmq.com
Sun Dec 12 19:56:14 GMT 2010


drenz wrote:
> I've updated the code to explicitly set body = null after I am done
> using it. See below.
> However, the memory continues to build up. This is the only part of
> the code that runs, so it has to be something in here.  It almost
> looks like the QueueingConsumer object might be keeping these
> references around.  Is that possible?

I suspect the leak is in the application code rather than the rabbit 
java client libs.

I suggest you try removing *all* application code from the receive loop, 
leaving it looking like this:

while (runInfinite) {
         QueueingConsumer.Delivery delivery = consumer.nextDelivery();
         byte[] body = delivery.getBody();
         channel.basicAck(delivery.getEnvelope().getDeliveryTag(), false);

Let us know whether you still see a leak with that.



More information about the rabbitmq-discuss mailing list