News for hackers. Stuff that matters.
Re:Drop millions of allocations by using a linked list (2015) by alexhutcheson on Friday March 12, 2021 @09:47AM (#26436333)
This is called arena allocation, and there are many implementations of the concept.

For example, the C++ Protocol Buffers library has an Arena class, which is documented here: https://developers.google.com/protocol-buffers/docs/referenc...

The EA STL has fixed_allocator, which implements a similar concept while exposing more low-level details in the API: https://github.com/electronicarts/EASTL/blob/master/include/...

Re:Drop millions of allocations by using a linked list (2015) by sgtnoodle on Friday March 12, 2021 @12:35PM (#26438358)
I'd describe it more as a pool or block allocator.

An arena allocator is specifically optimized for incremental allocation and then bulk deallocation (the entire arena is freed at once).

The example code instead appears to create a context of a number of fixed sized blocks. Because of the fixed size, the allocator can make a lot of simplifying assumptions and generally achieve constant time algorithmic complexity, while allowing for individual allocations to be freed and reused.