LeakCanary

LeakCanary is a memory leak detection library for Android. 

Memory leaks occur when an application allocates memory for an object, but then fails to release the memory when the object is no longer being used. Over time, leaked memory accumulates and results in poor app performance and even crashes.

Detecting memory leaks in Android applications using LeakCanary library.



To use LeakCanary, add the leakcanary-android dependency to your app’s build.gradle file:

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


That’s it, there is no code change needed!

Confirm that LeakCanary is running on startup by filtering on the LeakCanary tag in Logcat:

D LeakCanary: LeakCanary is running and ready to detect leaks


Notes

..


Comments