Supporting 'bookkeeping' and 'bin_unused' memory reporters in Gecko

Guilherme Goncalves ggp at mozilla.com
Thu Oct 30 15:45:47 PDT 2014


Hello,

Our memory reporting tools in Gecko rely on two statistics that don't seem straightforward
to obtain on latest jemalloc: "bookkeeping" and "bin_unused".

"bookkeeping" is defined as "Committed bytes which the heap allocator uses for internal data
structures." [1], and is currently calculated in our mozjemalloc as the total memory used by
all arena and chunk headers. As the comment in [2] suggests, it looks like this could be
computed by adding up all base allocations in jemalloc3.

"bin_unused" is defined as "Bytes reserved for bins of fixed-size allocations which do not
correspond to an active allocation." [3], and is computed in mozjemalloc by adding up the product
of each bin's number of free regions by their size.

I don't see a suitable mallctl call that would give us the information we need to compute these
metrics. Would it be possible to expose that information as statistics?

The associated Gecko bug for this is https://bugzilla.mozilla.org/show_bug.cgi?id=899126 .

Thanks!

1- http://dxr.mozilla.org/mozilla-central/source/xpcom/base/nsMemoryReporterManager.cpp#798
2- http://dxr.mozilla.org/mozilla-central/source/memory/build/mozjemalloc_compat.c?from=memory/build/mozjemalloc_compat.c#93
3- http://dxr.mozilla.org/mozilla-central/source/xpcom/base/nsMemoryReporterManager.cpp#780

-- 
Guilherme


More information about the jemalloc-discuss mailing list