Comment by o11c

Comment by o11c 2 days ago

0 replies

Some implementations might round up to encourage reuse:

* memory-checking allocators never do.

* purely-size-based allocators always do.

* extent-based allocators try to, but this easily fails if you're doing two interleaving allocations.

* the mmap fallback does only if allowing the kernel to choose addresses rather than keeping virtual addresses together, unless you happen to be on a kernel that allows not leaving a hole

Given that there's approximately zero overhead to do it right, just do it right (you don't need to store capacity, just compute it deterministically from the size).