简体   繁体   中英

how to test netty memory leak

I add -Dio.netty.leakDetection.level=ADVANCED for leak detecting on production. And there are some logs:

ERROR io.netty.util.ResourceLeakDetector - LEAK: ByteBuf.release() was not called before it's garbage-collected. See http://netty.io/wiki/reference-counted-objects.html for more information. WARNING: 4 leak records were discarded because the leak record count is limited to 4. Use system property io.netty.leakDetection.maxRecords to increase the limit. Recent access records: 5

Does it means it must will happen memory leak?

I want to test it on local environment, so I set -Dio.netty.leakDetection.level=PARANOID , but there are no the above memory leak records logs.

To detect leak on my development environment, I have reduce the heap size to 12 MB with this vm argument: -mx12m

Now with this, Netty is able to detect some leaks.

The log means that you have a memory-leak, so yes there is a leak. You can either configure leak detection via the system property (as you did) or via ResourceLeakDetector.setLevel(...) .

That you are not able to see the leak on your local machine may mean that you not see the same "allocation" patterns as on the prod server.

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