如何测试Netty内存泄漏 [英] how to test netty memory leak

查看:624
本文介绍了如何测试Netty内存泄漏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加了-Dio.netty.leakDetection.level=ADVANCED用于生产中的泄漏检测. 还有一些日志:

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

错误io.netty.util.ResourceLeakDetector-泄漏:在垃圾回收之前未调用ByteBuf.release().参见 http://netty.io/wiki/reference-counted-objects.html有关更多信息. 警告:因为泄漏记录数限制为4,所以丢弃了4条泄漏记录.使用系统属性io.netty.leakDetection.maxRecords可以增加限制. 最近访问记录:5

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?

我想在本地环境上对其进行测试,因此我设置了-Dio.netty.leakDetection.level=PARANOID,但是上面没有内存泄漏记录日志.

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.

推荐答案

要检测开发环境中的泄漏,我已使用以下vm参数将堆大小减小到12 MB:-mx12m

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

现在,Netty能够检测到一些泄漏.

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

这篇关于如何测试Netty内存泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆