square / leakcanary

A memory leak detection library for Android.
https://square.github.io/leakcanary
Apache License 2.0
29.31k stars 3.97k forks source link

Leak Canary doesn't seem to work as expected #660

Closed Pitel closed 7 years ago

Pitel commented 7 years ago

So I've added the dependcies and the snippet do the Application. And I also cerated a simple leak:

static Activity lol;

onCreate() {
    lol = this;
}

Now I have 2 devices.

On Nexus 5X with CM14.1 (Android 7.1), after the Activity is destroyed (swiped away in task switcher), notification about permission appears, I accept the permission, and that's all. Nothing is happening after that. I tried restarting the app, rebuilding the app, clearing app data, etc. Nothing.

On cheap tablet, with Android 5, the leak is detected, dumped and analyzed. But only first time. I can't reproduce it with Leak Canary. Even when I delete it from Leaks "App", I can't get it back.

Same behaviour on both devices on 1.5 and 1.6-SNAPSHOT versions.

sp-1234 commented 7 years ago

Same problem, on 7.1 it's not doing anything

JakeWharton commented 7 years ago

after the Activity is destroyed (swiped away in task switcher)

Swiping away the activity from the task switcher kills the process so the leak disappears. All you need to do is rotate the phone and wait 10 seconds.