Re:Memory Allocators 101 – Write a simple memory allocator (...
by flurrything on Wednesday October 10, 2018 @08:58AM
(#18184392)
> but sometimes you know invariants about object sizes, alloc patterns and free patterns that allow much more performant allocation.
jemalloc allows you to query these invariants if you don't know them, and to use the information to re-configure the allocator to match them :/
I'm pretty sure most modern allocators allow you to do this as well.
> The simplest case is if you know that you will free everything at once, or nothing at all.
That's pretty much a one liner with jemalloc.
The simplest case is if you know that you will free everything at once, or nothing at all. This allows you to eliminate most bookkeeping and allows a completely lock-free architecture. But there are also more complex cases where you can still get big benefits from exploiting known invariants.