user2093754
user2093754

Reputation: 71

Memory leak in netty API

I am new to netty API and I am using netty3.5.2 to develop client and server communication server, but the app always run full GC, I use jmap to dump the memory and use jhat to show which object occupied the memory.
And there are 6413363 instances of DefaultChannelFuture. can someone tell which thread create the DefaultChannelFuture instances and how and when they will be released?

Top 4 instances suspected
6413363 instances of class org.jboss.netty.channel.DefaultChannelFuture
631971 instances of class org.jboss.netty.util.internal.LinkedTransferQueue$Node
630934 instances of class org.jboss.netty.buffer.BigEndianHeapChannelBuffer
630767 instances of class org.jboss.netty.channel.DownStreamMessageEvent

Upvotes: 6

Views: 1376

Answers (2)

paziwatts
paziwatts

Reputation: 98

This question is a bit old now so not sure if you have found an answer. I haven't used it but the Netty in Action book describes a leak detector:

Netty contains a so called ResourceLeakDetector which will sample about 1% of buffer allocations to check if there is a leak in your application. In case of a detected leak you will see a log message similar to the following:

LEAK: ByteBuf.release() was not called before it's garbage-collected. Enable advanced leak reporting to find out where the leak occurred. To enable advanced leak reporting, specify the JVM option

-Dio.netty.leakDetectionLevel=advanced or call ResourceLeakDetector.setLevel()

Upvotes: 1

talex
talex

Reputation: 20436

You generating messages to fast. It overload message queue.

Check nethwork load.

Upvotes: 1

Related Questions