Post
Every byte of RAM is a limited resource and managing it badly turns your game into a crash-prone, stuttering mess.
Memory management in games encompasses all the strategies for allocating, using, and freeing memory efficiently. Games have strict memory budgets -- a console game might have 12 to 16 GB shared between GPU and CPU, and exceeding it means crashes. Custom allocators (pool allocators, stack allocators, frame allocators) replace general-purpose malloc/new with purpose-built systems that are faster and produce less fragmentation. Memory budgets are set per system -- rendering gets X GB, audio gets Y MB, physics gets Z MB. Memory fragmentation (small gaps between allocations that cannot be used) is managed through careful allocation patterns and periodic defragmentation. Streaming systems load and unload assets to stay within budget as the player moves through the world. Memory profiling tools track every allocation to find leaks and bloat.
Example
Naughty Dog's custom memory management system for The Last of Us Part II used multiple custom allocators tailored to different subsystems. The streaming system had a strict memory budget that would unload lower-priority assets when approaching the limit, ensuring the game never crashed from memory exhaustion even in the most asset-dense environments.
Why it matters
Memory is the hard ceiling that determines what a game can do on a given platform. Running out of memory means crashes, not slowdowns. Effective memory management lets developers push hardware to its limits while maintaining stability, and it is the skill that separates developers who can ship on consoles from those who can only target high-end PCs.
Related concepts