I've expanded on the explanation of size classes in my hardened allocator rather than quoting the jemalloc documentation since it was a bit too hard to understand:
github.com/AndroidHardeni
In jemalloc, this approach continues past small sizes to the largest allocation sizes too.
Conversation
The rationale for them continuing size class rounding beyond the sizes using slab allocation ('runs' in jemalloc) is optimizing poorly performing uses of realloc. It means a caller doing realloc from 4M to 8M in 16 byte increments will only need to adjust allocation size 4 times.
1
2
I don't currently implement comparable rounding for large allocations, but it's worth considering. In my allocator, rounding past the slab allocation threshold would only waste virtual memory by increasing guard region size. It only has the inherent page size rounding right now.
