Jetpack Compose Memory Leaks: A Reference-Graph Deep Dive
Jetpack Compose doesn’t “leak by default.” Most Compose leaks are plain old Kotlin reference leaks where something long-lived (a ViewModel, singleton, registry, static object, app scope coroutine) ends up holding a reference to something UI-scoped (an Activity Context, a composable lambda, a CoroutineScope, a remembered object). If you internalize one idea, make it this: Leaks happen when composition-scoped references escape into longer-lived holders. 0) The mental model you debug with Composition = runtime tree of nodes backing your […]