Conversation

Mandatory size classes end with 16KiB because it's the final size in the 2048 spacing class (10240, 12288, 14336, 16384) right before size class spacing matches the 4096 byte page size. There are 4 sizes per spacing (x5, x6, x7, x8) as a balance between different kinds of waste.
1
2
Replying to
However, it's really not worth it, especially since the earliest size classes (which are by far the most used) can't have fine granularity due to ABI alignment requirements. Doubling # of size classes would also double virtual memory that needs to be reserved for the slab region.
1
2
Another impact of the size classes is determining the # of reallocations needed to grow sequential data structures naively without a growth factor like 2x. 4 sizes per spacing means 4 actual reallocs for 2x growth. It's why I allowed using the size classes for large allocations.
2