explaingit

square/leakcanary

Analysis updated 2026-06-20

29,924KotlinAudience · developerComplexity · 2/5Setup · easy

TLDR

LeakCanary is an Android development library that automatically detects memory leaks in your app while you test it, pinpointing exactly which objects are being held in memory unnecessarily so you can fix the cause before shipping.

Mindmap

mindmap
  root((leakcanary))
    What it does
      Detect memory leaks
      Report leak traces
      Identify held objects
    How it works
      Runs during testing
      Watches allocations
      Sends notifications
    Use cases
      Android app debugging
      Performance profiling
    Tech stack
      Kotlin
      Android SDK
    Audience
      Android developers
      Mobile engineers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Automatically detect memory leaks during manual testing of an Android app without writing any detection code yourself.

USE CASE 2

Identify exactly which object chain is causing a leak so you can fix the root cause rather than guessing at the problem.

USE CASE 3

Add leak detection to an Android project with a single dependency line and no additional configuration.

What is it built with?

Kotlin

How does it compare?

square/leakcanaryalibaba/p3csignalapp/signal-android
Stars29,92430,83828,768
LanguageKotlinKotlinKotlin
Setup difficultyeasyeasyhard
Complexity2/52/54/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Add one Gradle dependency line and LeakCanary starts working automatically, no configuration or code changes required.

In plain English

LeakCanary is a library for Android apps that automatically detects memory leaks. A memory leak happens when an app holds onto chunks of memory it no longer needs, which over time causes the app to use more and more RAM, slow down, or crash. LeakCanary runs alongside your Android app during development, watches for these leaks, and reports exactly which objects are being held unnecessarily so developers can track down and fix the problem. Written in Kotlin, it integrates directly into Android projects.

Copy-paste prompts

Prompt 1
How do I add LeakCanary to my Android project and what happens the first time it detects a memory leak, what does the notification look like and where do I find the full leak trace?
Prompt 2
LeakCanary reported a leak in my Android Fragment. Show me how to read the leak trace it generates to find which line in my code is holding a reference it shouldn't keep.
Prompt 3
What is the difference between how LeakCanary detects Activity leaks versus Fragment leaks in an Android app, and does it work with Jetpack Compose screens?
Prompt 4
I want LeakCanary to only run in debug builds and not appear in my release APK. Show me how to configure the Gradle dependency so it is excluded from production builds.

Frequently asked questions

What is leakcanary?

LeakCanary is an Android development library that automatically detects memory leaks in your app while you test it, pinpointing exactly which objects are being held in memory unnecessarily so you can fix the cause before shipping.

What language is leakcanary written in?

Mainly Kotlin. The stack also includes Kotlin.

How hard is leakcanary to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is leakcanary for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub square on gitmyhub

Verify against the repo before relying on details.