From:  Kan-Ru Chen (陳侃如) <kchen@mozilla.com>
Date:  17 Nov 2015 12:15:44 Hong Kong Time
Newsgroup:  news.mozilla.org/mozilla.dev.memory
Subject:  

New memory profiling tool available

NNTP-Posting-Host:  63.245.214.181

Hi!

This is an on going project that recently moved into a usable state. The
objective is to let developers profile their website or apps to analyze
their memory allocation characteristics. For example it could be used to
find memory allocation hot spots that might give memory pressure to
other apps on the system.

The profiler is designed at the very beginning to support not only
JavaScript but also native codes. Naturally, not only JavaScript objects
but also native allocations are tracked.

It samples memory allocation based on accumulated allocation sizes so it
could detect both rapid allocations and large allocations. Each
allocation sampled has size and stack trace recorded so these sampled
events can be used to approximate the full history of allocations
afterwards. It also impose very low overhead on the system being
profiled.

Currently the gecko support has been landed on mozilla-central and
enabled by default. The ability to sample native allocations is enabled
when replace-malloc is enabled, which is default on Nightly.

The user interface is developed as an devtools add-on. Once installed it
could be accessed from developer toolbar or WebIDE.
Here are instructions for installing and using the Memory Profiler add-on:
https://developer.mozilla.org/en-US/docs/Mozilla/Performance/Memory_Profiler

We also plan to work on a command line interface for scripting and
custom post-processing.

Here is the project page if you are interested and want to contribute:
https://wiki.mozilla.org/MemoryProfiler

Please try it out and file bugs in the "Core" product and "Gecko
Profiler" component! We want this to be a useful tool for _you_!

Cheers,
Kanru