简体   繁体   中英

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

You generating messages to fast. It overload message queue.

Check nethwork load.

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()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM