In C++ allocators are special classes that practically do what their name suggests, they allocate and deallocate memory. They are used mainly by STL containers (vector, map etc) and they act as an interface/guide for the container’s memory management.
Allocators is a somewhat hidden feature that most C++ programmers don’t bother messing around with. For the most cases the default STL allocator (std::allocator) is enough and it works just fine. For some specific cases though where performance is essential developers create their own allocators that work around some design problems and limitations the default allocator has.
This article presents some consepts relevant to game development in C++11. More specifically:
1. Create a custom allocator that resembles std::allocator
2. Why replace the default allocator?
3. Stack allocator
Continue reading “Custom C++ allocators suitable for video games”