For Developers‎ > ‎

about:tracing memory snapshots

Project started June 2013.
jamescook@, nduca@


A common complaint on Chrome OS is "when I do my usual morning workflow, my browser process bloats to 400+ MB" or "when I use Gmail for an hour, the renderer gets very large."  Often these problems are difficult to reproduce for developers. We decided to build an experimental tool that reports on tcmalloc heap memory usage using the about:tracing TRACE_EVENT macros to generate stacks (instead of real stacks with symbols).

Advantages:
* Runs on standard, official builds
* Potentially works anywhere we have tcmalloc - Linux and Chrome OS work now, Windows to come
* Does not require symbols
* Allows memory traces to be saved and sent to developers
* Runs with minimal performance overhead, estimated < 5%

Disadvantages:
* Does not provide real stacks, only task names and nested trace events
* Getting more detailed traces requires more TRACE_EVENT macros to be added
* Won't help on Mac, where we're not using tcmalloc
* about:tracing UI to turn it on is somewhat technical

How to use:
* Run Chrome for Linux or Chrome OS after svn revision 213473. (It landed on July 25, 2013 so should ship in R30.)
* Navigate to about:tracing and check the "memory" checkbox on the right. (To reduce memory consumption, uncheck most of the other boxes. Leave one or two checked - there's a bug where we sometimes don't display the memory data without timing information from another trace.)



* Run Chrome for a while (> 5 seconds), then click "Stop" in about:tracing.
* You'll get a profile like this of memory consumption every 5 seconds.


The numbers do not sum to the totals because we hide a large number of small allocations (<= 0.1 MB).  Known issues:

* Only the top trace, for the browser process, shows the breakdown.
* Sometimes the display is blank. Deleting your browser's profile (user data directory) seems to work around this.

Android developers:
This system is reported to work on Android, but you must:
* Build using tcmalloc
* Use adb_chrome_tracing, not strace

Comments