23 assert((size > 0) &&
"Allocated block size must be greater than zero!");
27 uint8_t* buffer = _buffer + _size;
31 if ((size + (aligned - buffer)) <= (_capacity - _size))
50 assert((ptr !=
nullptr) &&
"Deallocated block must be valid!");
63 assert((_allocated == 0) &&
"Memory leak detected! Allocated memory size must be zero!");
64 assert((_allocations == 0) &&
"Memory leak detected! Count of active memory allocations must be zero!");
static bool IsValidAlignment(size_t alignment) noexcept
Is the given alignment valid?
static T * Align(const T *address, size_t alignment=alignof(T), bool upwards=true) noexcept
Align pointer (upwards or downwards)
void free(void *ptr, size_t size)
Free the previously allocated memory block.
void * malloc(size_t size, size_t alignment=alignof(std::max_align_t))
Allocate a new memory block of the given size.
void reset()
Reset the memory manager.
C++ Common project definitions.