5 concepts · 10 practice questions
A leak is an object that is no longer needed but is still reachable from a GC root. On Android the classic one is a long-lived object, such as a singleton, static field, or running task, holding an Activity, View, or Fragment. LeakCanary finds them by watching destroyed objects.
object Analytics {
lateinit var context: Context // pass applicationContext, never an Activity
}
Sign in to read the rest and take the 10-question test.
Sign in to continue