Shai Barack investigates Android apps that keep old screens in memory after users leave them. Perfetto puts a snapshot of live objects on the same timeline as process memory and app events. You can see when memory climbed, then follow the references to find what kept it alive.

  • Start with retained size. A tiny Kotlin wrapper can keep a large native graphics buffer alive. Rank objects by the memory that would be freed if they became unreachable, then inspect the field that holds the reference.
  • Check what outlived the screen. An activity’s callback registry can retain a destroyed fragment. A camera preview can linger if its cleanup is cancelled before it unregisters.
  • Turn the investigation into a check. Perfetto’s SQL queries work in the browser and in automated tests. Across many traces, group dumps by the reference chains they share to see which causes recur.

Reproduce the teardown that left the objects alive, then capture a fresh snapshot after the fix. The original reference chain gives you a more specific regression check than watching the process memory counter go down.