- Published on
Android Memory: How to Use Leak Detection Tools
- Authors
- Name
- Dan Tech
- @dan_0xff
In the process of developing Android applications, developers inevitably encounter Memory Leaks. This article aims to provide knowledge and experience in finding Leaks as quickly as possible through the Android Profiler and Leaks Canary tools.
Android Studio Profiler to Observe Memory and Detect Leaks
Open the Profiler tool from Android Studio: View / Tool Windows / Profiler
Select the app to Monitor
Observe the Memory and CPU screen
Snap Memory to observe Leaks
Leak Canary to Observe and Detect Leaks
Add dependency
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.14'
Reproduce the Leak and wait for Heapdumps