LeakLens is an Android memory leak detector for the IntelliJ Platform. It runs the Shark ( LeakCanary) engine host-side to analyze heap dumps via ADB and provides real-time static analysis using UAST.
- Runtime: Shark 2.14 (LeakCanary engine)
- Static Analysis: UAST (Universal Abstract Syntax Tree)
- Target: Kotlin, Java
- Integrations: Compose, Hilt, Coroutines, WorkManager
- Connectivity: ADB (Zero-SDK / No app modifications)
Catch leaks while writing code, before you even hit "Run". LeakLens uses UAST inspections to highlight problematic signatures:
- Jetpack Compose:
Contextcapture in@Composableorrememberblocks. - Coroutines: Unsafe
Flowcollection outside ofrepeatOnLifecycleorflowWithLifecycle. - DI: Hilt scope mismatches (e.g., Singleton injecting Activity-scoped components).
- Classic Patterns: Static Activity refs, anonymous inner classes, and missing
onDestroycleanup.
Analyze your app's memory without adding any dependencies to your production APK.
- ADB Offloading: Triggers
am dumpheapand pulls the HPROF to your machine. - Desktop Performance: Graph traversal and reachability analysis are performed using your computer's resources, avoiding device OOMs during analysis.
- AI Fix Assistant: Maps complex reference chains to idiomatic Kotlin remediation steps using LLMs (Gemini/OpenAI).
Once a fix is applied, re-verify it instantly.
- 1-Click Verify: Triggers a fresh heap dump to confirm the leak is resolved.
- Baseline Manager: Track known issues and focus only on new regressions.
| Feature | LeakLens | Android Profiler | LeakCanary |
|---|---|---|---|
| Feedback Loop | Authoring/Real-time | Manual/Debugging | Runtime |
| IDE Integration | Native Tool Window | Partial | None |
| APK Impact | Zero | Zero | ~300KB+ |
| Remediation | AI-Powered Fixes | Manual | Trace only |
LeakLens uses a Deterministic Verification Platform to ensure analysis accuracy:
- Golden Fixtures: Pre-captured heaps and JSON expectations in
verification/golden/. - Regression Engine: Standalone tool that validates Shark output against historical "ground truth" data.
- Install LeakLens from the JetBrains Marketplace.
- Open the LeakLens tool window (Bottom Tab).
- Connect a debuggable device and click Dump Heap Now.
- **Official Page **: DroidUnplugged
- Author: Vikas Soni
Licensed under Apache 2.0.