Skip to content

Instantly share code, notes, and snippets.

@louis-langholtz
louis-langholtz / stateless_vs_stateful_cpp_allocators.md
Last active January 27, 2024 15:01
C++: Stateless vs. Statefull Allocators

C++: Stateless vs. Stateful Allocators

Categorizing Allocators

All standard C++ library conforming allocators have to support the minimal interface requirements. Beyond these requirements, some examples of fully defined allocators are LLVM's latest standard C++ library implementation of std::allocator, and a custom allocator I've written called ThreadLocalAllocator. These are both examples of what's been categorized as "stateless" allocators. Alternatively, allocators can be "stateful".