tree: 8f1f6562aa33d05eeded239c429563a5671d8b0e [path history] [tgz]
  1. address.h
  2. allocation_event.cc
  3. allocation_event.h
  4. allocation_tracker.cc
  5. allocation_tracker.h
  6. backtrace.cc
  7. backtrace.h
  8. backtrace_storage.cc
  9. backtrace_storage.h
  10. backtrace_storage_unittest.cc
  11. BUILD.gn
  12. DEPS
  13. json_exporter.cc
  14. json_exporter.h
  15. json_exporter_unittest.cc
  16. memlog_connection_manager.cc
  17. memlog_connection_manager.h
  18. memlog_receiver.h
  19. memlog_receiver_pipe.cc
  20. memlog_receiver_pipe.h
  21. memlog_receiver_pipe_posix.cc
  22. memlog_receiver_pipe_posix.h
  23. memlog_receiver_pipe_win.cc
  24. memlog_receiver_pipe_win.h
  25. memlog_stream_parser.cc
  26. memlog_stream_parser.h
  27. memlog_stream_parser_unittest.cc
  28. memlog_stream_receiver.h
  29. OWNERS
  30. profiling_browsertest.cc
  31. profiling_manifest.json
  32. profiling_service.cc
  33. profiling_service.h
  34. README.md
chrome/profiling/README.md

chrome/profiling

This document describes the architecture for the profiling process, which tracks memory allocations in other processes. See design doc for more details.

There is some additional information in //chrome/common/profiling/README.md

How To Enable Out of Process Heap Profiling

Navigate to chrome://flags/#memlog and set the flag to “Profile only the browser process.” It's possible to profile all processes, but that has a higher performance impact, and heap dumps of renderer processes are less actionable.

How To Use Out of Process Heap Profiling

By default, you don‘t need to do anything. The heap profiler will detect when the browser’s memory usage has exceeded a certain threshold and upload a trace.

To force an upload, or to create a heap dump manually, see chrome://memory-internals. The resulting heap dump is intended to be used with symbolize_trace and diff_heap_profiler.py.

It's also possible to view the heap dump within a memory-infra trace, although the results will still need to be symbolized with symbolize_trace.

Due to size constraints, most allocations are pruned from the heap dump. Only allocations of sufficient size and/or frequency are kept. After pruning, the result is ~100x smaller, but still accounts for about half of all allocations. More importantly, it still accounts for all obvious memory leaks.

Communication Model

When profiling is enabled, the browser process will spawn the profiling service. The services lives in a sandboxed, utility process, and its interface is at chrome/common/profiling/memlog_service.mojom.

All other processes, including the browser process, are ProfilingClients. See profiling_client.mojom. Depending on the profiling mode, the browser process will start profiling for just itself and the GPU process [--memlog=minimal], or itself and all child processes [--memlog=all].

The browser process creates a pipe for each ProfilingClient that allows the client processes to communicate memory events to the profiling process.

Code Locations

//chrome/common/profiling - Logic for MemlogClient. //chrome/browser/profiling_host - Logic in browser process for starting profiling service, and connecting MemlogClients to the profiling service. //chrome/profiling - Profiling service.