What is an Android memory leak? Give a Context example and fix.

Tests understanding of Activity Context retention preventing GC. A strong answer defines a leak as unreachable objects, gives a static singleton example, names LeakCanary, and fixes it with Application Context. Red flag: blaming GC or suggesting System.gc().
Tests whether you understand that an Activity retained by a long-lived reference cannot be garbage collected, exhausting the app heap. A strong answer defines a leak as unreachable objects held by reachable roots, gives the static singleton caching an Activity Context example, names LeakCanary or heap dump analysis, and fixes it with Application Context or WeakReference. Red flag: blaming the garbage collector, suggesting System.gc(), or claiming leaks are impossible in managed languages.
Read the original → developer.android.com
- #android
- #memory management
- #context
- #interview
- #performance
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.