Re:Why I Write Games in C (yes, C)
by PrototypeNM1 on Saturday September 21, 2019 @08:20PM
(#21038790)
> A lot of game engines use a mark-and-release per-frame allocation buffer.
I've heard of this concept but a search for "mark-and-release per-frame allocation buffer" returned this thread. Is there something else I could search?
Re:Why I Write Games in C (yes, C)
by theresistor on Saturday September 21, 2019 @09:05PM
(#21038966)
Itβs just a variation of arena allocation. You allocate everything for the current frame in an arena. When the frame is complete. You free the entire arena, without needing any heap walking.
A generational GC achieves a similar end result, but has to heuristically discover the generations, whereas an arena allocator achieves the same result deterministically And without extra heap walking.
Re:Why I Write Games in C (yes, C)
by meheleventyone on Sunday September 22, 2019 @08:59AM
(#21041164)
Linear or stack allocator are other common terms. Just a memory arena where an allocation is just a pointer bump and you free the whole buffer at once by returning the pointer to the start of the arena.
Garbage collection emulates the intent of this method with generational collection strategies, but it has to use a heuristic to do so. And you can optimize your code to behave very similarly within a GC, but the UI to the strategy is full of workarounds. It is more invasive to your code than applying an actual manual allocator.