Open 3D Engine AzCore API Reference 26.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
Allocators

AZStd uses a simple, non-templated allocator model. Unlike std::allocator, AZStd allocators are not parameterized on a value type, they operate on raw bytes with explicit size and alignment parameters. This makes them lightweight and avoids per-type allocator instantiation.

AZStd allocators support alignment directly in allocate/deallocate, which differs from std::allocator where alignment is handled implicitly via operator new.

Allocator type requirements for use with AZStd containers:

struct allocator
{
using value_type = void;
using size_type = size_t;
using difference_type = ptrdiff_t;
using align_type = size_t;
[[nodiscard]] void* allocate(size_type byteSize, size_type alignment);
void deallocate(void* ptr, size_type byteSize, size_type alignment);
// Optional
[[nodiscard]] void* reallocate(void* ptr, size_type newSize, align_type alignment = 1);
size_type max_size() const;
size_type get_allocated_size() const;
friend bool operator==(const allocator&, const allocator&);
};