Hey y'all,
I've just landed
this CL . This adds some heap usage metrics to the venerable profiler in chrome://profile. Initially this is disabled for official builds, but I hope to change that shortly (once the bugs have been shaken out). On Windows, due to how this hooks into the allocator, it's only available in non-component release builds, alas.
This instrumentation will allow you to see the average number of allocations & frees, the average net number of heap bytes consumed, as well as the high watermark of outstanding bytes during a single task execution. You can also add extra columns to see the cumulative metrics for your tasks.
This builds on all the existing goodness of chrome://profiler, which means you can break this down by process type, thread or a variety of other ways. You can grab multiple snapshots and diff them, as well as save the data you're looking at for a closer perusal later, or to attach to bugs.
On Windows (and hopefully one day on other platforms) the byte counts include a lower-bound estimate of the heap overhead incurred on allocation. Comparing the "Allocated bytes" and the "Overhead bytes" cumulative metrics can be instructive, and may give you data that'd motivate a move to "clumpier" data structures if your data is a cloud of small allocs :).
Now, while "cumulative allocated bytes" - "cumulative freed bytes" is the number of outstanding bytes, this instrumentation is probably not super-helpful for finding leaks or memory hogs. Since individual tasks can be net positive or net negative in memory consumption, it's generally not possible to see where the outstanding allocations originated.
It should however be helpful in optimizing your code toward less memory churn and heap overhead.
Please be on the lookout for weirdness like e.g. this <
http://crbug.com/669593>, and do let me know if you find this useful.
Siggi