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

AZStd uses simple and fast allocator model, it does not follow the CStd. It is not templated on any type, thus is doesn't care about construction or destruction. We do require name support, in most cases should be just a pointer to a literal.

This is the specification for an AZSTD allocator:

class allocator
{
public:
// Type of the returned pointer. Usually void*
typedef <impl defined> pointer_type;
// Size type, any container using this allocator will use this size_type. Usually AZStd::size_t
typedef <impl defined> size_type;
// Pointer difference type, usually AZStd::ptrdiff_t.
typedef <impl defined> difference_type;
// Allowing memory leaks will instruct allocator's users to never
// even bother to call deallocate. This can result in a faster code. Usually is false_type.
typedef true_type (or false_type) allow_memory_leaks;
allocator(const char* name = "AZSTD Allocator");
allocator(const allocator& rhs);
allocator(const allocator& rhs, const char* name);
allocator& operator=(const allocator& rhs;
pointer_type allocate(size_type byteSize, size_type alignment, int flags = 0);
void deallocate(pointer_type ptr, size_type byteSize, size_type alignment);
size_type resize(pointer_type ptr, size_type newSize);
const char* get_name() const;
void set_name(const char* name);
// Returns theoretical maximum size of a single contiguous allocation from this allocator.
size_type max_size() const;
<optional> size_type get_allocated_size() const;
};
bool operator==(const allocator& a, const allocator& b);
bool operator!=(const allocator& a, const allocator& b);
Attention
allow_memory_leaks is important to be set to true for temporary memory buffers like: stack allocators, etc. This will allow AZStd containers to have automatic "leak_and_reset" behavior, which will allow fast destroy without memory deallocation. This is especially important for temporary containers that make multiple allocations (like hash_maps, lists, etc.).