How to test net memory leak

I add -Dio.netty.leakDetection.level=ADVANCED to detect production leakage. And there are several magazines:

ERROR io.netty.util.ResourceLeakDetector - LEAK: ByteBuf.release () is not called before garbage collection. See http://netty.io/wiki/reference-counted-objects.html for more details. WARNING: 4 leak records have been discarded because the number of leak records is limited to 4. Use the io.netty.leakDetection.maxRecords system property to increase the limit. Recent access entries: 5

Does this mean that a memory leak should occur?

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

+5
source share
2 answers

To detect a leak in my development environment, I reduced the heap size to 12 MB with this vm argument: -mx12m

Now with this Netty can detect some leaks.

+1
source

Logging means you have a memory leak, so yes, there is a leak. You can either configure leak detection through a system property (like you) or through ResourceLeakDetector.setLevel(...) .

The fact that you cannot see the leak on your local machine may mean that you do not see the same distribution patterns as on the prod server.

0
source

Source: https://habr.com/ru/post/1267267/


All Articles