防止漏金丝雀误报 [英] Preventing false positives with Leak Canary

查看:82
本文介绍了防止漏金丝雀误报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们发现Leak Canary出现了很多错误的阳性结果,即Leak Canary检测到存在泄漏,但随后又出现了以下消息:

We observe a lot of false-positives with Leak Canary, ie., Leak Canary detects that there is a leak but later comes back with the message:

LeakCanary: * NO LEAK FOUND. 

我认为这是因为GC没有及时声明该对象.我们有什么办法可以减少这些误报?

I think this is because GC didn't claim the object in time. Is there anything that we could do to reduce these false positives ?

推荐答案

使用过滤器LeakCanary查看LogCat.
未收集GC的可疑参考信息时,会出现一条消息.转储开始之前. 在此消息中,您将看到班级名称.

Look at LogCat with filter LeakCanary.
There's a message when suspicious reference not GC collected. Right before dump start. In this message you'll see class name.

这篇关于防止漏金丝雀误报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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