2 ms·
I needed to Google about "bump allocators". I found this: https://stackoverflow.com/questions/62076569/is-this-implementation-of-malloc-a-bump-allocator https:
by throwaway2037 2y ago
I needed to Google about "bump allocators". I found this: https://stackoverflow.com/questions/62076569/is-this-implementation-of-malloc-a-bump-allocator https://stackoverflow.com/questions/62076569/is-this-impleme...
> It's a really naive allocator that can be very fast due to the tiny amount of housekeeping involved, but you have to live with a pretty heavy constraint: there's no "free" operation for individual request - you just destroy the whole thing.
To me, this sounds like an arena allocator. I remember seeing them in Apache SVN source code a squillion years ago. What's the big deal? For RAII, we can just do placement new in the ctor, and "arena free/delete" in dtor -- which might do nothing in practice.
Also, was the original article focused on gamedev? I don't see any mention of it. For us normie programmers working on CRUD apps, we don't need bump/arena allocators. Ctor->new, RAII/Dtor->delete is just fine for us.
- jpc0 2y ago> Also, was the original article focused on gamedev? I don't see any mention of it. For us normie programmers working on CRUD apps, we don't need bump/arena allocators. Ctor->new, RAII/Dtor->delete is just fine for us. Yes arena allocators is the word I couldn't remember, a bump allocator is a way to implement an arena allocator and probably the most popular. Also I 100%, in general you shouldn't need an arena allocator, but if you are building a library you should be aware of allocators and make however you are allocating memory configurable so that if you do need to some day change it it doesn't involve a complete rewrite.