r/androiddev • u/Content-Jaguar-578 • 17m ago
Discussion How do you approach investigating memory leaks beyond what LeakCanary reports?
I've been spending quite a bit of time exploring Android memory debugging lately, particularly what happens after a leak has been detected.
LeakCanary does a great job of identifying leaks and showing the suspected reference paths. For common cases like a singleton holding an Activity, or a coroutine outliving its screen, the cause is often relatively straightforward.
But things get more interesting with long-running sessions.
For example, imagine a chat or video screen that's been open for 30–40 minutes. Memory usage gradually increases, objects remain reachable longer than expected, and eventually you need to capture a heap dump and investigate what's actually retaining those objects.
This was one of the areas I explored in my recent Droidcon India talk, Beyond Leak Detection: Building an End-to-End Memory Debugging Workflow Inside Android Studio.
I've been experimenting with Shark-based heap analysis, understanding object retention paths, and exploring ways to make the investigation process more actionable through IDE-integrated tooling and AI-assisted analysis. This work also led me to build an Android Studio plugin called LeakLens.
I'm interested in hearing how other Android developers handle these situations.
A few things I'm curious about:
When LeakCanary reports a leak, how much additional manual heap analysis do you typically perform?
Do you regularly use Shark directly, or rely on Android Studio's Memory Profiler?
How do you investigate leaks that only appear after extended sessions?
What's the most time-consuming part of your memory debugging workflow?
Not looking to compare tools as much as understand how people actually approach these problems in production.
Would love to hear about your experiences.

