关闭

LEAK: ByteBuf.release() was not called before it's garbage-collected. Enable advanced leak reporting

标签: ByteBuf-rereleasenetty5leakjvm
944人阅读 评论(2) 收藏 举报
分类:

问题描述:

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

ByteBuf是一个引用计数对象,这个对象必须显示地 调用release()方法来释放。

解决方法:

@Override
 public void channelRead(ChannelHandlerContext ctx, Object msg) {
 try {
 // Do something with msg
} finally {
 ReferenceCountUtil.release(msg);
 }
 }
0
1

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:256889次
    • 积分:4693
    • 等级:
    • 排名:第6446名
    • 原创:216篇
    • 转载:36篇
    • 译文:0篇
    • 评论:38条
    文章分类
    最新评论