The Deep Memory Profiler tools (dmprof) were not maintained, became non-functional, and were removed from the codebase . See issue 490464.
Deep Memory Profiler (dmprof) is a 1) whole-process, 2) timeline-based and 3) post-mortem memory profiler for Chromium. It's designed to categorize all memory usage in a process without any omission. See the Design Doc if interested.
Memory bloat has been a serious issue in Chromium for years. Bloat is harder to fix than leak and errors. We have memory checkers like Valgrind and Address Sanitizer for leak and errors, but no handy tools for bloat. Dmprof is an easy-to-use tool for bloat to know “who is the memory eater”. (It would be helpful also for leak.)
Future announcements (e.g. command line changes) will be done in email@example.com. Subscribe it if you're interested.
Dmprof profiles memory usage post-mortem. You need to 1) get memory dumps while Chrome is running, and then 2) analyze the dumps. The analyzing script dmprof is available in src/tools/deep_memory_profiler of the Chromium source tree, or can be retrieved by downloading and running download.sh.
You can use dmprof for Chromium static builds with some build options both for Release and Debug builds. Note that it is not available for shared builds.
Be careful not to overwrite GYP_DEFINES predefined by env_setup.sh.
Run Chromium with a command-line option --no-sandbox and the following environment variables:
Prepare a file /var/tmp/deep_memory_profiler_prefix.txt in your device or VM image. Its content should just have a prefix to dumped files /path/to/prefix like:
If you get dumps from a standalone Chromium process periodically, prepare a file /var/tmp/deep_memory_profiler_time_interval.txt which contains just an integer meaning the interval time to dump:
If you specified "time interval" described above, the Chromium process dumps heap profiles periodically. It depends on the platform how to specify "time interval".A WebDriver (ChromeDriver) API function is available to dump. Try dump_heap_profile():
Note that you may want to copy the dumps from your remote machine if you run ChromeDriver remotely.
You can dump heap profiles manually from DevTools (or automatically with your script) when you set the environment variables above and specify the command line option --enable-memory-benchmarking to Chrome.
You can use a Telemetry profiler to drive chrome and, if running on android, to also fetch the files from the device. It utilizes the above Memory Benchmarking V8 API internally. See Telemetry instructions.
Find the dumps at /path/to/prefix.*.heap as specified above. Names of the dumps include Process IDs. For example, prefix.12345.0002.heap for pid = 12345. '0002' is a sequence number of the dump.
The dmprof analyzer script (in the Phase 5) needs the executed Chrome binary to extract symbols. If you analyze in the same host with the Chrome process, you don't need special things. If you analyze in a different host from the Chrome process (it's common in Android and ChromeOS), you may need to specify the path to the executed Chrome binary on the host. (See Phase 5 for details.)
Heap profiles are dumped to the directory where you specified in the environment variable HEAPPROFILE.
Heap profiles are dumped in the device directory where you specified in the property heapprof. Fetch the dump from the device to your host by the following command.
The dmprof script guesses the path of the Chrome binary on the host if the executed binary was in an Android-specific directory (e.g. /data/app-lib/). If the guess fails, use --alternative-dirs for the dmprof script (in the Phase 5).
Heap profiles are dumped in the device directory where you specified in /var/tmp/deep_memory_profiler_prefix.txt. Fetch them in a certain way like scp from the device / VM.
The dmprof script doesn't know where is the Chrome binary on the host. Use --alternative-dirs for the dmprof script (in the Phase 5).
Use the dmprof script to analyze with the dumped heap profiles.
Or, use this to generate a local html with a graph and a data table:
# Generate a JSON output for your dumps.
$ tools/deep_memory_profiler/dmprof json /path/to/first-one-of-the-dumps.heap > FOO.json
# Convert the JSON file to a HTML file.
$ tools/deep_memory_profiler/graph.py FOO.json > graph.html
In case of Android or ChromeOS, you may need to use --alternative-dirs for the dmprof script to specify the path of the Chrome binary on the host instead of the path on the device.
Given a specific component listed in the graph above, sue the following command to
Graphs are typical stacked ones which classifies all memory usage into some components. We have four kinds of graphs from each execution dump based on four built-in "policies": l0, l1, l2, t0.
We're preparing more breakdown policies. If you'd like to add a criteria for your component, 1) modify policy.*.json files, 2) modify polices.json and add a policy file or 3) report it to firstname.lastname@example.org.
This policy applies the most rough classification.
It breaks down memory usage into relatively specific components.
It tries to breakdown memory usage into specific components. See policy.l2.json for details, and report to email@example.com to add more components.
It classifies memory blocks based on their type_info.
For Developers >