tree: 3f41ae0c08900067d76c15a8bd64a3141a9fd372 [path history] [tgz]
  1. adding_memory_infra_tracing.md
  2. heap_profiler.md
  3. heap_profiler_internals.md
  4. memory_infra_startup_tracing.md
  5. probe-cc.md
  6. probe-gpu.md
  7. README.md
docs/memory-infra/README.md

MemoryInfra

MemoryInfra is a timeline-based profiling system integrated in chrome://tracing. It aims at creating Chrome-scale memory measurement tooling so that on any Chrome in the world --- desktop, mobile, Chrome OS or any other --- with the click of a button you can understand where memory is being used in your system.

Getting Started

  1. Get a bleeding-edge or tip-of-tree build of Chrome.

  2. Record a trace as usual: open chrome://tracing on Desktop Chrome or chrome://inspect?tracing to trace Chrome for Android.

  3. Make sure to enable the memory-infra category on the right.

    Tick the memory-infra checkbox when recording a trace.

  4. For now, some subsystems only work if Chrome is started with the --no-sandbox flag.

Timeline View and Analysis View

After recording a trace, you will see the timeline view. Timeline view shows:

  • Total resident memory grouped by process (at the top).
  • Total resident memory grouped by subsystem (at the top).
  • Allocated memory per subsystem for every process.

Click one of the M dots to bring up the analysis view. Click on a cell in analysis view to reveal more information about its subsystem. PartitionAlloc for instance, has more details about its partitions.

Component details for PartitionAlloc

The purple M dots represent heavy dumps. In these dumps, components can provide more details than in the regular dumps. The full details of the MemoryInfra UI are explained in its design doc.

Columns

Columns in blue reflect the amount of actual physical memory used by the process. This is what exerts memory pressure on the system.

  • Total Resident: (TODO: document this).
  • Peak Total Resident: (TODO: document this).
  • PSS: (TODO: document this).
  • Private Dirty: (TODO: document this).
  • Swapped: (TODO: document this).

Columns in black reflect a best estimation of the the amount of physical memory used by various subsystems of Chrome.

  • Blink GC: Memory used by Oilpan.
  • CC: Memory used by the compositor. See cc/memory for the full details.
  • Discardable: (TODO: document this).
  • Font Caches: (TODO: document this).
  • GPU and GPU Memory Buffer: GPU memory and RAM used for GPU purposes. See GPU Memory Tracing.
  • LevelDB: (TODO: document this).
  • Malloc: Memory allocated by calls to malloc, or new for most non-Blink objects.
  • PartitionAlloc: Memory allocated via PartitionAlloc. Blink objects that are not managed by Oilpan are allocated with PartitionAlloc.
  • Skia: (TODO: document this).
  • SQLite: (TODO: document this).
  • V8: (TODO: document this).
  • Web Cache: (TODO: document this).

The tracing column in gray reports memory that is used to collect all of the above information. This memory would not be used if tracing were not enabled, and it is discounted from malloc and the blue columns.

Related Pages

Rationale

Another memory profiler? What is wrong with tool X? Most of the existing tools:

  • Are hard to get working with Chrome. (Massive symbols, require OS-specific tricks.)
  • Lack Chrome-related context.
  • Don't deal with multi-process scenarios.

MemoryInfra leverages the existing tracing infrastructure in Chrome and provides contextual data:

  • It speaks Chrome slang. The Chromium codebase is instrumented. Its memory subsystems (allocators, caches, etc.) uniformly report their stats into the trace in a way that can be understood by Chrome developers. No more __gnu_cxx::new_allocator< std::_Rb_tree_node< std::pair< std::string const, base::Value*>>> ::allocate.
  • Timeline data that can be correlated with other events. Did memory suddenly increase during a specific Blink / V8 / HTML parsing event? Which subsystem increased? Did memory not go down as expected after closing a tab? Which other threads were active during a bloat?
  • Works out of the box on desktop and mobile. No recompilations with unmaintained GYP_DEFINES, no time-consuming symbolizations stages. All the logic is already into Chrome, ready to dump at any time.
  • The same technology is used for telemetry and the ChromePerf dashboard. See the slides and take a look at some ChromePerf dashboards and telemetry documentation.

Development

MemoryInfra is based on a simple and extensible architecture. See the slides on how to get your subsystem reported in MemoryInfra, or take a look at one of the existing examples such as malloc_dump_provider.cc. The crbug label is Hotlist-MemoryInfra. Don't hesitate to contact tracing@chromium.org for questions and support.

Design documents

Architectural:

Chrome-side design docs:

Catapult-side design docs: