Comment by yxhuvud
3 years ago
You can however use bump allocation for things that are not arenas. There are some GC allocators that use the technique.
3 years ago
You can however use bump allocation for things that are not arenas. There are some GC allocators that use the technique.
The 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.
This 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).