3 ms·
Didn't know these were called Arenas, this technique is prevalent in game development.
by yelnatz 3y ago
Didn't know these were called Arenas, this technique is prevalent in game development.
- TickleSteve 3y agoalso called a "bump" allocator... because all it does is bump a pointer. nice to use when you have a nicely ordered order of execution where you are guaranteed to always come back to a known position where you can free the entire heap/arena at once. (i.e. a typical main message handling loop).
- yxhuvud 3y agoYou can however use bump allocation for things that are not arenas. There are some GC allocators that use the technique.
- dgb23 3y agoThe JVM GC has a generational model. It first allocates objects into an arena like structure. In a second step, it moves (evacuates) long lived objects into a compact region. The first region gets deallocated at once after. Roughly speaking this leans on a heuristic that most objects are short lived. So it has arena like characteristics, but is of course managed/dynamic. This might be one reason why managed languages like Java/C# get such good out of the box performance. You really need insight in your program and how it executes to beat this.
- neonsunset 3y agoThis is correct. In .NET Gen 0 heap, if there is sufficient space, the allocation is just getting a heap address from threadlocal, bumping an offset, writing object header and methodtable, and returning the pointer (reference).
- naasking 3y agoAlso called "regions".