News for hackers. Stuff that matters.
Re:Bump Allocation: Up or Down? by DaiPlusPlus on Monday March 25, 2024 @10:13PM (#39823638)
Pardon my ignorance, but this bump-allocator looks like a reinvention of arena-allocators. Is there something I’m missing?
Re:Bump Allocation: Up or Down? by kazinator on Monday March 25, 2024 @11:35PM (#39824050)
Bump allocation specifically means doing nothing but moving a pointer by a displacement related to the object size.

While "arena allocator" is also used for the same thing, it doesn't exclusive have that meaning. It also refers to region-based memory management in general. An arena allocator can be versatile, allowing objects of different sizes to be freed in any order, and coalesced for new allocation. The arena part of is that the application can throw the whole arena away in one operation.

Bump allocation isn't always used inside arenas that can themselves be allocated or freed. It can be global also. Operating system kernels use such an approach for initialization-time allocation of permanent objects. The classic Unix sbrk() mimics that.

Re:Bump Allocation: Up or Down? by NobleExpress on Monday March 25, 2024 @10:41PM (#39823794)
They're (effectively) the same. Bump allocation is the term in GC literature and is the more general term. Arena allocation can be slightly more nuanced as you can throw an entire arena away after you're done with it (if your problem domain allows for it). But arena allocation is just a kind of bump allocation for all intents and purposes.
Re:Bump Allocation: Up or Down? by adamrezich on Monday March 25, 2024 @10:53PM (#39823860)
I've heard the terms used interchangeably.
Re:Bump Allocation: Up or Down? by o11c on Tuesday March 26, 2024 @04:21PM (#39832398)
"Arena" is a heavily overloaded term. Usually arenas have more logic than a mere bump allocator though. Sometimes "arena" means "thread-local cache", so objects can be free'd to a different arena than they came from, etc. Arenas might be a single finite-size underlying allocation or contain multiple of those dynamically. Arenas might be able to answer the question "did this arena allocate this pointer originally"? Arenas might be user-facing objects or internal implementation details only.