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

#include <allocator_stack.h>

Public Types

using pointer = void *
 
using size_type = AZStd::size_t
 
using difference_type = AZStd::ptrdiff_t
 

Public Member Functions

AZ_FORCE_INLINE stack_allocator (void *data, size_t size, const char *name="AZStd::stack_allocator")
 
AZ_FORCE_INLINE const char * get_name () const
 
AZ_FORCE_INLINE void set_name (const char *name)
 
constexpr size_type max_size () const
 
AZ_FORCE_INLINE size_type get_allocated_size () const
 
pointer allocate (size_type byteSize, size_type alignment, int flags=0)
 
AZ_FORCE_INLINE void deallocate (pointer ptr, size_type byteSize, size_type alignment)
 
AZ_FORCE_INLINE size_type resize (pointer ptr, size_type newSize)
 
AZ_FORCE_INLINE void reset ()
 

Detailed Description

Allocator that allocates memory from the stack (which you provide) The memory chunk is grabbed on construction, you CAN'T new this object. The memory will be alive only while the object exist. DON'T USE this allocator unless you are SURE you know what you are doing, it's dangerous and tricky to manage. How to use: void MyFunction() { stack_allocator myAllocator(AZ_ALLOCA(size),size,"Name"); // ... // NO reference to any memory after myAllocator goes out of scope. }


The documentation for this class was generated from the following file: