← Back to context

Comment by yelnatz

3 years ago

Didn't know these were called Arenas, this technique is prevalent in game development.

also 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).

  • 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.

      1 reply →