Skip to content

DefaultMemoryAllocator

class DefaultMemoryAllocator final : public MemoryAllocator

Default memory allocator.

This implementation uses a fast and efficient "proxy" allocator designed to handle many small allocations/deallocations in heavy multithreaded scenarios.

Functions

Name Description
DefaultMemoryAllocator Initializes a new default memory allocator.
~DefaultMemoryAllocator Destroy the allocator.
Malloc @inherit
Realloc @inherit
Malign @inherit
Realign @inherit
Free @inherit
SizeOf @inherit

Function Details

DefaultMemoryAllocator

DefaultMemoryAllocator(AmUInt32 bucketsCount, AmSize bucketSizeInBytes)

Initializes a new default memory allocator.

This constructor will create the given number of allocator buckets, each of the given size.

Parameter bucketsCount
The number of allocator buckets to create.
Parameter bucketSizeInBytes
The size of each allocator bucket in bytes.

Free

void Free(eMemoryPoolKind pool, AmVoidPtr address) override

@inherit

Malign

AmVoidPtr Malign(eMemoryPoolKind pool, AmSize size, AmUInt32 alignment) override

@inherit

Malloc

AmVoidPtr Malloc(eMemoryPoolKind pool, AmSize size) override

@inherit

Realign

AmVoidPtr Realign(eMemoryPoolKind pool, AmVoidPtr address, AmSize size, AmUInt32 alignment) override

@inherit

Realloc

AmVoidPtr Realloc(eMemoryPoolKind pool, AmVoidPtr address, AmSize size) override

@inherit

SizeOf

AmSize SizeOf(eMemoryPoolKind pool, AmVoidPtr address) override

@inherit

~DefaultMemoryAllocator

~DefaultMemoryAllocator() override

Destroy the allocator.