This repository contains the code for my master thesis of various memory allocation strategies and allocators. Some allocators are a mess others are finished but it ain't production ready.
Have a look at the Thesis.
Games are real-time applications composed of numerous subsystems, like rendering, physics, AI, audio and each with distinct memory allocation patterns. Memory allocation can become a significant bottleneck, yet academic literature on composable allocator systems for game engines remains sparse. This thesis investigates the impact of custom memory allocation strategies on game engine performance, addressing two research questions: how different allocation strategies impact performance, and whether custom allocators provide measurable improvements over general-purpose allocators in realistic scenarios.
A composable allocator library was developed in the Rust programming language, inspired by Alexandrescu’s allocator building blocks, Zig’s allocator interface, and memory management practices from production game engines including Naughty Dog and Bluepoint. The library implements arena, stack, pool, free-list, buddy, and bitmapped-block allocators as composable building blocks, along with combinators that modify allocator behavior.
The Rust implementation leverages the type system to enforce memory safety invariants at compile time while maintaining zero-cost abstractions. Performance was evaluated through synthetic benchmarks simulating realistic game engine workloads on x86_64 architecture. Arena allocators achieved up to 17.7x throughput improvement for small allocations and 13.8x faster bulk deallocation compared to
the system allocator. Pool allocators demonstrated 5.98x speedup in block-reuse scenarios typical of particle systems and game entities. Per-frame allocation scenarios showed 1.18x improvement when using arena allocators with bulk reset. These results empirically validate the memory management practices observed in production game engines and demonstrate that specialized allocators, when matched to appropriate usage patterns, provide substantial, measurable performance benefits