Was thinking about implementing realloc for arena allocator, so I did some digging. And I really like how Rust allocator's idea of splitting realloc into shrink and grow.
Conversation
With "grow," what we want is "if we can't grow in place, we still want to grab some memory elsewhere." With "shrink," we want to guarantee that no new memory gets allocated. They are two very different operations.
1
7
Replying to
Modern allocators need to switch to a new smaller allocation to shrink it unless it rounds to the same size class. A shrinking function that's unable to move the allocation is a broken function. They aren't particularly different operations with slab allocation, etc.

