Memory¶
Memory management and allocation
Types¶
Name | Description |
---|---|
AmUniquePtr | Unique pointer type. |
MemoryManager | Manages memory allocations inside the engine. |
MemoryManagerConfig | Configures the memory management system. |
MemoryPoolKind | Available memory pools. |
MemoryPoolStats | Collects the statistics about the memory allocations * for a specific pool |
ScopedMemoryAllocation | Allocates a block of memory with the given size in the given pool. |
am_delete | Deleter for unique pointers. |
Macros¶
Name | Description |
---|---|
amMemory | Shortcut access to the Amplitude's memory manager instance. |
amdelete | Deallocates a memory allocated with @ref amnew amnew. |
amfree | Deallocates a block of memory from the default memory pool. |
ammalign | Allocates a block of memory from the default memory pool. |
ammalloc | Allocates a block of memory from the default memory pool. |
amnew | Allocates memory for a new object in the Default pool using the memory manager. |
ampooldelete | Deallocates a memory allocated with @ref ampoolnew ampoolnew. |
ampoolfree | Deallocates a block of memory from the specified memory pool. |
ampoolmalign | Allocates an aligned block of memory from the specified memory pool. |
ampoolmalloc | Allocates a block of memory from the specified memory pool. |
ampoolnew | Allocates memory for a new object in the given memory pool. |
ampoolrealign | Reallocates an aligned block of memory from the specified memory pool. |
ampoolrealloc | Reallocates a block of memory from the specified memory pool. |
amrealign | Reallocates an aligned block of memory from the default memory pool. |
amrealloc | Reallocates a block of memory from the default memory pool. |
Macro Details¶
amMemory¶
#define amMemory
Shortcut access to the Amplitude's memory manager instance.
amdelete¶
#define amdelete(type, ptr)
Deallocates a memory allocated with @ref amnew amnew.
This will call the object's destructor before the memory is freed.
- Parameter
_type_
- The type of the object to deallocate.
- Parameter
_ptr_
- The pointer to the object to deallocate.
- See
- amnew
amfree¶
#define amfree(ptr)
Deallocates a block of memory from the default memory pool.
- Parameter
_ptr_
- The pointer to deallocate.
- See
- ampoolfree
ammalign¶
#define ammalign(size, alignment)
Allocates a block of memory from the default memory pool.
- Parameter
_size_
- The size of the memory to allocate.
- Parameter
_alignment_
- The alignment of the memory to allocate.
- See
- ampoolmalign
ammalloc¶
#define ammalloc(size)
Allocates a block of memory from the default memory pool.
- Parameter
_size_
- The size of the memory to allocate.
- See
- ampoolmalloc
amnew¶
#define amnew(type, ...)
Allocates memory for a new object in the Default pool using the memory manager.
This will create a new memory allocation in the Default pool. The allocated memory will be freed when the object is destroyed using amdelete.
- Parameter
_type_
- The type of the object to allocate.
- Parameter
Additional
- arguments to pass to the constructor of the object.
- See
- amdelete
ampooldelete¶
#define ampooldelete(pool, type, ptr) \
Deallocates a memory allocated with @ref ampoolnew ampoolnew.
This will call the object's destructor before to free the memory.
- Parameter
_pool_
- The memory pool to deallocate from.
- Parameter
_type_
- The type of the object to deallocate.
- Parameter
_ptr_
- The pointer to the object to deallocate.
- See
- ampoolnew
ampoolfree¶
#define ampoolfree(pool, ptr)
Deallocates a block of memory from the specified memory pool.
- Parameter
_pool_
- The memory pool to deallocate from.
- Parameter
_ptr_
- The pointer to deallocate.
ampoolmalign¶
#define ampoolmalign(pool, size, alignment)
Allocates an aligned block of memory from the specified memory pool.
- Parameter
_pool_
- The memory pool to deallocate from.
- Parameter
_size_
- The size of the memory to allocate.
- Parameter
_alignment_
- The alignment of the memory to allocate.
ampoolmalloc¶
#define ampoolmalloc(pool, size)
Allocates a block of memory from the specified memory pool.
- Parameter
_pool_
- The memory pool to allocate from.
- Parameter
_size_
- The size of the memory to allocate.
ampoolnew¶
#define ampoolnew(pool, type, ...)
Allocates memory for a new object in the given memory pool.
This will create a new memory allocation in the given pool. The allocated memory will be freed when the object is destroyed using ampooldelete.
- Parameter
_pool_
- The memory pool to allocate from.
- Parameter
_type_
- The type of the object to allocate.
- Parameter
Additional
- arguments to pass to the constructor of the object.
- See
- ampooldelete
ampoolrealign¶
#define ampoolrealign(pool, ptr, size, alignment)
Reallocates an aligned block of memory from the specified memory pool.
- Parameter
_pool_
- The memory pool to reallocate from. Should be the same as the one used to allocate the memory.
- Parameter
_ptr_
- The pointer to reallocate.
- Parameter
_size_
- The new size of the memory.
- Parameter
_alignment_
- The alignment of the memory to reallocate.
ampoolrealloc¶
#define ampoolrealloc(pool, ptr, size)
Reallocates a block of memory from the specified memory pool.
- Parameter
_pool_
- The memory pool to reallocate from. Should be the same as the one used to allocate the memory.
- Parameter
_ptr_
- The pointer to reallocate.
- Parameter
_size_
- The new size of the memory.
amrealign¶
#define amrealign(ptr, size, alignment) \
Reallocates an aligned block of memory from the default memory pool.
- Parameter
_ptr_
- The pointer to reallocate.
- Parameter
_size_
- The new size of the memory.
- Parameter
_alignment_
- The alignment of the memory to reallocate.
- See
- ampoolrealign
amrealloc¶
#define amrealloc(ptr, size)
Reallocates a block of memory from the default memory pool.
- Parameter
_ptr_
- The pointer to reallocate.
- Parameter
_size_
- The new size of the memory.
- See
- ampoolrealloc