[rabbitmq-discuss] RabbitMQ Client Memory issues

Emile Joubert emile at rabbitmq.com
Tue Jan 31 11:54:53 GMT 2012


Hi Yogesh,

On 31/01/12 09:56, Yogesh Ketkar wrote:
> After running a java client for a while (15-20 minutes), it runs out
> of memory with OutOfMemoryError.
> I probably can postpone the problem by giving high values for -Xmx.
> 
> Doing jmap and jhat gave following info.
> 
> 173233 instances of class com.rabbitmq.client.impl.AMQCommand
> 173233 instances of class com.rabbitmq.client.impl.CommandAssembler
> 173132 instances of class com.rabbitmq.client.impl.ChannelN
> 173132 instances of class com.rabbitmq.client.impl.ConsumerDispatcher
> 173096 instances of class com.rabbitmq.client.ShutdownSignalException
> 173096 instances of class com.rabbitmq.client.impl.AMQImpl$Channel
> $Close
> 
> I create a channel at the beginning of run() method of the thread and
> close() it in the finally block.
> But seems like all see all the instances of
> com.rabbitmq.client.impl.ChannelN
> 
> any idea, what can be going wrong?

It is possible that you are creating channels that aren't being garbage
collected by the Java VM. If possible you should use only a small number
of channels and then this problem won't occur. For performance reasons
also you should avoid establishing a new channel for each message as
this introduces network overhead and delay.



-Emile


More information about the rabbitmq-discuss mailing list