When to change memory allocator in game engine?
But remember that memory allocation is an optimisation, so you should often profile your use-case before implementing a more specific allocator. If you notice that your game is slow iterating through entities because they’re scattered around in memory, you should probably change to an allocator that pack things tightly.
How does memory manager work in a game?
They talk about it a little in the gamasutra link under Memory Manager Types in Games. Basically, you identify an issue and try to solve that issue. Their example is that when you render a scene, you use a lot of memory that are not needed in the next frame.
What are memory allocation patterns used in game development?
Game Engine Architecture has some information regarding this topic. The basics are that you need to do some analysis to understand what your memory requirements per level/frame/etc. are like, but there are a few patterns the author mentions having seen several times:
What kind of memory do you need in a game?
Perhaps LSR (Load and Stay Resident, the kind of thing that will be needed throughout the entirety of your game) from the top, and per-level data from the bottom. Single frame memory, or double-buffered frame memory: Memory for operations that occur within one or two frame cycles.
Which is the best memory allocator for a game?
Many smaller games uses only heap allocation (new or malloc) and works fine. Custom memory allocation is an optimisation and depends on your specific use-case (although, there are commonalities).
When do you need a dynamic memory allocator?
If you have assets that are loaded and unloaded sporadically, you’ll need a more dynamic allocator (which is often less performant). So it all depends on exactly how your game works. Many smaller games uses only heap allocation (new or malloc) and works fine.