liveBook · Manning

Memory profiler

As explained in Fast by Default

Memory Profiler is an Android profiling tool that displays application memory usage and helps detect objects and screens retained after they should be released.

Memory Profiler is an Android diagnostic tool that displays application memory usage by category, including Java or Kotlin code, native code, graphics, and system resources. A healthy application rises during use and settles at a stable ceiling; continued growth indicates retained objects that should have been released. section 7.3.3

Use the graph and leak detection to distinguish recurring failure patterns:

  • A steadily rising graph suggests a memory leak or another object-retention problem. section 7.3.3
  • A rapid sawtooth pattern indicates frequent creation and disposal of short-lived objects, which can cause stuttering during animation and scrolling. section 7.3.3
  • Automatic leak detection identifies common Android leaks, names the leaked object, and shows what keeps it alive. section 7.3.3

Rotation retaining an old screen

After device rotation, Android destroys the current screen and creates another. A background thread, long-lived variable, or registered listener that still references the old screen can retain its views and keep the invisible screen in memory. section 7.3.3

How Fast by Default covers it

How deep it goes
Explains graph interpretation and automatic leak detection, but stops short of a complete testing workflow.
Examples
Uses stable-ceiling and sawtooth graphs, navigation-retained screens, and device rotation as diagnostic examples.
What it assumes
Assumes basic Android screen and reference concepts while defining strong references and retain cycles for unfamiliar readers.
What you can do after
Diagnose retained objects and allocation pressure by reading memory graphs and following profiler-reported leak references.
How it connects
Connects memory leaks with strong references, retain cycles, weak references, screen lifecycle, and short-lived object allocation.

Also explained in

Compare how 2 books explain memory profiler →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fast by Default. The section links point to the parts of the book it draws on.