YUNOVA · Android Development · Module 12: Performance and testing
Memory leaks and LeakCanary
Memory leaks and LeakCanary
Key points
- A leak happens when an object outlives its use, such as an Activity held by a static field.
- LeakCanary watches destroyed objects in debug builds and reports leaks with a trace.
- Clear listeners and avoid holding Context in long-lived objects.