Allocator
The Allocator namespace provides a flexible and efficient memory management interface for both raw and typed allocations. All allocations are guaranteed to be 32-byte aligned on binaries with AVX support; otherwise, allocations are 16-byte aligned. It supports low-level memory operations as well as high-level utilities for constructing and destroying C++ objects and arrays. For non-POD (plain old data) types, constructors and destructors are explicitly called to ensure proper object lifecycle management. The namespace also includes functions to retrieve memory usage statistics, to track the amount of total allocated memory and the number of active allocations.
#include <core/TellusimAllocator.h>
Functions
Raw allocation.
void *allocate(size_t size)
void *reallocate(void *ptr, size_t old_size, size_t new_size)
void free(const void *ptr, size_t size)
Object allocation.
template<> static Type *allocate()
template<> static void freeObject(Type *ptr)
Array allocation.
template<> static Type *allocate(size_t size)
template<> static void freeArray(Type *ptr, size_t size)
Memory statistics.
size_t getMemory()
size_t getAllocations()