On this page
Overview
LeakCanary is a development diagnostic library that finds Android objects that were not released and shows the reference path retaining them.
Features and best fit
Based on official documentation; not hands-on tested · Content checked:
Key features
Watch objects that should be released and analyze their reference paths
LeakCanary watches Android objects such as destroyed activities, captures a heap dump when they remain retained, and reports a leak trace from a GC root to the object.
Sources: [4]
Best fit
Connect reproducible Android interactions to the retaining reference
Added as a debug dependency, it lets developers reproduce navigation on a development device and inspect notifications and traces. It fits teams that need a concrete reference path rather than a memory-growth symptom.
Before adoption
Treat debug-build analysis as evidence to investigate
Heap analysis takes time and storage, and not every retained object is a defect. The fixed in-repository sample uses minSdk 24, compileSdk 36, Android Gradle Plugin 9.2.1, JDK 17, and Gradle wrapper 9.6.1. Build that sample as debug and keep it separate from release artifacts.
Official sources
- [1]LeakCanary README at commit 1aa85dc(2026-10-05)
- [2]LeakCanary v3.0-alpha-9 release(2026-10-05)
- [3]LeakCanary getting started(2026-10-05)
- [4]LeakCanary fundamentals(2026-10-05)
- [5]LeakCanary GitHub metadata(2026-10-05)
- [6]LeakCanary Apache license at commit(2026-10-05)
- [7]LeakCanary fixed sample debug dependencies and Android configuration(2026-10-05)
- [8]LeakCanary fixed sample MainActivity leak actions(2026-10-05)
- [9]LeakCanary fixed sample button labels(2026-10-05)
- [10]LeakCanary fixed SDK and AGP versions(2026-10-05)
- [11]LeakCanary fixed Gradle wrapper(2026-10-05)
Supplemental curator note
LeakCanary fits Android teams that need to trace retained objects after navigation back to their reference paths. Keep it in debug builds and development devices, then correlate each trace with reproduction steps and code changes.
Try it in 3 steps
- 1
Inspect requirements and the debug integration point
Requires Git, JDK 17, and Android SDK 36. Check out the fixed commit and verify minSdk 24 and compileSdk 36; the build uses its Gradle 9.6.1 wrapper and Android Gradle Plugin 9.2.1.
git clone https://github.com/square/leakcanary.git leakcanary && cd leakcanary && git checkout --detach 1aa85dc0472d6e38966a649741a7ce30f828d162 && test "$(sed -n 's/androidMinSdk = "\([0-9]*\)"/\1/p' gradle/libs.versions.toml)" = 24 && test "$(sed -n 's/androidCompileSdk = "\([0-9]*\)"/\1/p' gradle/libs.versions.toml)" = 36 - 2
Build and install the in-repository debug sample
Build and install the fixed sample that already uses debugImplementation(projects.leakcanary.leakcanaryAndroid) on a connected device or emulator; no published release dependency is added.
./gradlew :samples:leakcanary-android-sample:installDebug - 3
Leak and destroy MainActivity, then inspect the analysis
In Example App, tap “Leak Activity,” then “Finish” to destroy MainActivity. Open the heap-dump notification and inspect the reference-path analysis.
adb shell am start -n com.example.leakcanary/.MainActivity && printf '%s\n' 'On the device: tap "Leak Activity", then "Finish" to destroy MainActivity. Wait for the LeakCanary heap-dump notification, open it, and inspect the reference-path analysis.'
Growth
Growth trends · Last 30 days
30,005 Stars
Trend data is still being collected.
Development activity
Last 90 days · weekly
- Commits (last 30 days)
- 81
- Open PRs
- 15
Development activity is still being collected.
Built with
Categories and tags
Categories
GitHub data
GitHub dataView detailed GitHub data
GitHub Topics
- android
- memory-leak
- java
- kotlin
- kotlin-android
- outofmemory
- outofmemoryerror
- leakcanary
- leak-canary
- leak-trace
- Stars
- 30,005
- Forks
- 3,994
- Watchers
- 977
- Open issues
- 115
- Contributors
- 145
- Owner type
- Organization
- Primary language
- Kotlin
- License
- Apache-2.0
- Repository last updated
- Oct 5, 2026
Related information
Write a related articleShare a guide or use case for this OSS in Markdown. Articles are published after administrator approval.
Explore next
- Appium22,043 Stars
1 shared tag(s) · 2 shared category(s)
automate end-to-end tests for Android, iOS, and desktop apps through WebDriver-compatible APIs
TypeScript - kotlinx.coroutines13,820 Stars
1 shared tag(s) · 1 shared category(s) · Same language
Structure asynchronous and concurrent work in Kotlin with the official library
Kotlin - Exposed9,292 Stars
1 shared tag(s) · 1 shared category(s) · Same language
Choose a type-safe Kotlin SQL DSL or DAO and compose JDBC/R2DBC, migrations, and Spring integration as modules
Kotlin - MockK5,762 Stars
2 shared tag(s) · 2 shared category(s) · Same language
mock, stub, and verify Kotlin collaborators with coroutine and Android support
Kotlin - Mockito15,454 Stars
2 shared tag(s) · 2 shared category(s)
replace Java collaborators and keep unit tests focused
Java - AndroidX Test1,225 Stars
2 shared tag(s) · 2 shared category(s)
build Android instrumented and UI tests with AndroidJUnitRunner, Espresso, and AndroidX Test Core
Java
Report incorrect information
Tell us if any listing information is incorrect or outdated.