Question about bitmap code

Mitchell Blank Jr mitch-jemalloc-discuss at
Mon Nov 5 03:53:13 PST 2012

I've been looking through some of the jemalloc code and had a question
about bitmap.h.

Testing on a 64-bit machine, the arena bin with the most elements is size=8
with 501 items.  Since a cacheline is commonly 64 bytes = 512 bits, a
simpler single-level bitmap would seem to win just on memory effects.

It's not clear to me if its advantageous on a branching basis, at least on
64-bit.  On average you'd need to look at 4 words to find an unused 8-byte
entry, and fewer for other size bins.  I guess on a 32-bit platform, it
might be a different story.  Still, I wonder if it is worth touching
another cache line to avoid the comparisons.

Are there cases where the bitmap code is used for more than 512 items in it?

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

More information about the jemalloc-discuss mailing list