Hacker News new | ask | show | jobs
by harrison_clarke 741 days ago
there's a common gamedev practice of allocating a big chunk of memory up front, and then using a bump allocator inside of it

in most games, there are about 3 "lifetimes": - permanent/startup - per-level - per-frame

and they're nested. so, you can use a single stack allocator for all of them. at the end of the frame/level, pop back to where it started

there are more complicated patterns, but this one will get you pretty far. you can use it on the CPU and the GPU

1 comments

where to read more? any books? articles?
game engine architecture, by jason gregory

there's a section on memory allocation patterns

i believe casey muratori talks about allocation patterns in the handmade hero video series, too

edit: ryan fleury has a talk: https://www.rfleury.com/p/enter-the-arena-talk