statistical counters from jemalloc - Similar to mall info()

Jason Evans jasone at
Mon Oct 19 12:16:26 PDT 2015

On Oct 19, 2015, at 3:10 AM, Prajakta <praj.jagtap at> wrote:
> Is there a way by which we can get actual number of bytes of data allocated by JEMALLOC + number of bytes allocated by mmap / bro system call in jemalloc?
> I am looking for counters similar to mallinfo counters in jemalloc.
> Using mall info() we get information about memory allocations performed using malloc.
> I need similar counters from jemalloc:
> - hblkhd:      Number of bytes in blocks currently allocated using mmap(2)
> - uordblks:  Total number of bytes usd by in-use allocations 
> - fordblks:   Total number of bytes in free blocks.
> Out of above 3, I suspect, stats.allocated is similar to uordblks.

Unfortunately, mallinfo()'s API has some implementation detail baked in, and it doesn't map perfectly to jemalloc.  Nonetheless, jemalloc does provide similar, more detailed stats.

hblkhd: Under typical operating conditions, jemalloc allocates *all* memory via mmap(), so this stat isn't generally useful.  That said, <> and <> may be of interest depending on your use case.
uordblks: Precisely the same as <> .
fordblks: Use <> or <> and subtract out <> .

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the jemalloc-discuss mailing list