Speaking of Leaking
summary
Shows a real memory leak: a static HashSet holds Activity contexts and a 7.72 MB bitmap so rotating the screen accumulates Activity instances until the app hits ~1 GB and the kernel kills it. Demonstrates detection with LeakCanary and the Android memory profiler, explains GC roots and generational/compacting collectors, and reproduces leaks via anonymous inner classes and AsyncTask. Presents fixes: use application context or weak references, cancel work, clean up RxJava disposables, and prefer lifecycle-aware LiveData observe(owner) to avoid forgotten observers.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 0:24Background
- 3:55RAM Storage
- 5:08Stack vs Heap Memory
- 6:52Linux Kernel
- 7:43Memory Pressure
- 15:48Android L Garbage Collection
- 18:29Android Framework
- 20:03Memory Leaks
- 22:14Memory Leak Example
- 31:43Fixing a Memory Leak
- 40:30Summary
related talks
24mUnveiling the Unseen Threat: Demystifying Memory Leaks in Android
33mNuking Nasty Memory Leaks
34mMemory Leaks & Performance Considerations: A Cookbook
37mRoot causing memory growth with LeakCanary 3
49mPokeLeaks: Gotta Catch 'em All
28mMemory Leaks & Performance Considerations: A Cookbook
31mA Small Leak Can Sink A Great Ship
47mLeakCanary, and Then? Unraveling Android Memory Leaks
