[英]How to identify memory leaks in Android
如何檢查Android中的內存泄漏?
我嘗試在Eclipse中使用Memory Analyzer工具,但是從它生成的報告中,我查詢了一個特定的類,但我從中什么也沒得到。
此外,關於此特定對象為何可能成為內存泄漏的原因的文檔也很少。
任何人都可以舉例說明嗎?
使用泄漏金絲雀
添加到build.gradle
:
dependencies {
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
}
在Application class
:
public class ExampleApplication extends Application {
@Override public void onCreate() {
super.onCreate();
LeakCanary.install(this);
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.