allocator icon indicating copy to clipboard operation
allocator copied to clipboard

investigate small / large / huge size class design

Open thestinger opened this issue 10 years ago • 0 comments

The current small size classes are the multiples of 16 in the range [16..512]. There are essentially no large size classes at all, as it simply rounds the size up to 16 and uses address-ordered best-fit for the entire [528..4194272] range. Huge allocations are simply multiples of 4194304 (4MiB), the chunk size.

One major drawback to the current small size class design is the high number of slab size classes. It would make more sense to expand the gap between size classes as they grow larger. However, it's very important to have size classes that are quick to calculate. The current design has the benefit of being implemented as (size + 15) & ~15 which is blazing fast.

Another drawback to the current design is that incremental vector reallocation has pathological performance characteristics. Ideally, programs wouldn't do this but the sad reality is that many do so it's probably important to deal with it.

The size classes in jemalloc are very well-designed, but calculating them is way too expensive.

thestinger avatar Jan 04 '15 23:01 thestinger