Skip to content

MemoryAllocator

class MemoryAllocator

Memory Allocator Interface.

Functions

Name Description
~MemoryAllocator Default Destructor.
Malloc Allocates a block of memory.
Realloc Reallocates a block of memory.
Malign Allocates an aligned block of memory.
Realign Reallocates an aligned block of memory.
Free Deallocates a block of memory.
SizeOf Gets the size of the memory at the given address.

Function Details

Free

virtual void Free(eMemoryPoolKind pool, AmVoidPtr address) = 0

Deallocates a block of memory.

Parameter pool
The memory pool to deallocate from.
Parameter address
The pointer to the memory to deallocate.

Malign

virtual AmVoidPtr Malign(eMemoryPoolKind pool, AmSize size, AmUInt32 alignment) = 0

Allocates an aligned block of memory.

Parameter pool
The memory pool to allocate from.
Parameter size
The size of the memory to allocate.
Parameter alignment
The alignment of the memory to allocate.
Return
A pointer to the allocated memory.

Malloc

virtual AmVoidPtr Malloc(eMemoryPoolKind pool, AmSize size) = 0

Allocates a block of memory.

Parameter pool
The memory pool to allocate from.
Parameter size
The size of the memory to allocate.
Return
A pointer to the allocated memory.

Realign

virtual AmVoidPtr Realign(eMemoryPoolKind pool, AmVoidPtr address, AmSize size, AmUInt32 alignment) = 0

Reallocates an aligned block of memory.

Parameter pool
The memory pool to reallocate from.
Parameter address
The pointer to the memory to reallocate.
Parameter size
The new size of the memory.
Parameter alignment
The alignment of the memory to reallocate.
Return
A pointer to the reallocated memory.

Realloc

virtual AmVoidPtr Realloc(eMemoryPoolKind pool, AmVoidPtr address, AmSize size) = 0

Reallocates a block of memory.

Parameter pool
The memory pool to reallocate from.
Parameter address
The pointer to the memory to reallocate.
Parameter size
The new size of the memory.
Return
A pointer to the reallocated memory.

SizeOf

virtual AmSize SizeOf(eMemoryPoolKind pool, AmVoidPtr address) = 0

Gets the size of the memory at the given address.

Parameter pool
The memory pool to get the size from.
Parameter address
The address of the memory.
Return
The size of the memory at the given address.

~MemoryAllocator

virtual ~MemoryAllocator() = default

Default Destructor.