Jemalloc stats

Justin Lebar justin.lebar at gmail.com
Wed Apr 4 10:36:40 PDT 2012


> jemalloc tracks usable size rather than request size for all allocations, whether small, large, or huge, and it supports using the full size reported by malloc_usable_size() (not to mention the "real size" reported by the *allocm() API).

Yeah, I changed this in our port.  :)  The usable size of a huge
allocation is rounded up to the next page, so rather than "usable
size", it's "size you can use without committing any additional
memory".

>  Modifying huge allocations to no longer be a multiple of the chunk size would have some
> unfortunate chunk management side effects.  Is this causing special pain in the context of Windows?

We still allocate the chunk rounded up to the next MB, but we report
its usable size rounded up to the next page.  I think I added a new
field to the huge rbtree node to store this.

We did this because our memory reporters (about:memory) use
malloc_usable_size to determine how much memory an allocation uses,
and it's important that we be able to distinguish between committed
memory and uncommitted memory.



More information about the jemalloc-discuss mailing list