SuperMalloc icon indicating copy to clipboard operation
SuperMalloc copied to clipboard

gap near 128 bytes and 256 bytes

Open kuszmaul opened this issue 10 years ago • 1 comments

There's a gap near 128 for unaligned malloc. We don't use 128 since it's a power of two, so if you allocate 113 bytes, you get 160 bytes, which is 29.4% external fragmentation.

If we use the 128-byte size, then we'll get reduced associativity.

One solution is to add another object size (say at 136). Doing that will change the calculation between sizes and bins (which currently works up to 320 using bit hacking).

There's another gap at 256 (since we don't like 256) which we could fix by adding a size at 272.

kuszmaul avatar Jun 08 '15 02:06 kuszmaul

Or we could allow allocations of 128 and 256, even for nonaligned allocations, and just cope with the associativity problems. For 2 and 4 cache lines, it's not really so bad.

kuszmaul avatar Jun 29 '15 03:06 kuszmaul