LeakCanary Android Memory leak detection


LeakCanary is Android library to detect memory leak.

In the past, Android developers just check DDMS and check memory use not to happen memory leak. (It’s not easy to find)

LeakCanary is very simple to use


It’s simple, just add one line to build.gradle

dependencies {
  // debugImplementation because LeakCanary should only run in debug builds.
  debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.2'

This is only Debug. And care of version

How do we know?

Once, we start to debug application with leak canary, LeakCanalry app is installed.

And we can see memory leak if we have

Professional Programmer2