13 assert((size > 0) &&
"Allocated block size must be greater than zero!");
16 #if defined(_WIN32) || defined(_WIN64)
17 void* result = HeapAlloc(GetProcessHeap(), 0, size);
19 void* result = std::malloc(size);
21 if (result !=
nullptr)
32 assert((ptr !=
nullptr) &&
"Deallocated block must be valid!");
36 #if defined(_WIN32) || defined(_WIN64)
37 HeapFree(GetProcessHeap(), 0, (LPVOID)ptr);
50 assert((_allocated == 0) &&
"Memory leak detected! Allocated memory size must be zero!");
51 assert((_allocations == 0) &&
"Memory leak detected! Count of active memory allocations must be zero!");
void reset()
Reset the memory manager.
void * malloc(size_t size, size_t alignment=alignof(std::max_align_t))
Allocate a new memory block of the given size.
void free(void *ptr, size_t size)
Free the previously allocated memory block.
static bool IsValidAlignment(size_t alignment) noexcept
Is the given alignment valid?
C++ Common project definitions.