Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How many game studios roll out their own allocator?


I would be surprised if it isn't a number approaching 100%, at least from my experience in the industry.

Even in managed languages you see extensive use of pooling to achieve the same effect.


Is it just for fine-tuning to the exact usecase? Otherwise I'd expect to at least see common libraries pop up.


Yeah, they generally tend to be gameplay/engine specific. Much in the same way that you wouldn't want to use an open world(heavy emphasis on streaming, instancing) for a fighting game(no frame drops ever, 60 fps) and vice-versa.

Usually they get broken down into a couple discreet subsystem:

1. Particle systems - Pooled, fixed size.

2. Per-level/region entity pooling - Tuned based on encounter.

3. Strings, etc - Usually preallocated to avoid fragmentation.

4. Ring/command buffers - Again, fixed size and mostly preallocated. Generally used for rendering and job systems.

There's a couple other case I'm missing and as always a lot of this is also biased not only towards avoiding allocation but also arranging data in memory in such a way that it's friendly to your L1/L2 cache(things accessed sequentially laid out in memory sequentially, SoA/AoS and all that good stuff).

There's a lot of really impressive engineering that goes into things like allocation, in-place loading, seek-free loading(less so now with caching to HDD) and the like.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: