Default memory manager class.
More...
#include <allocator.h>
Default memory manager class.
Default memory manager uses malloc() and free() system functions to allocate and deallocate memory.
Not thread-safe.
- Examples
- memory_arena.cpp, and memory_pool.cpp.
Definition at line 186 of file allocator.h.
◆ DefaultMemoryManager() [1/3]
CppCommon::DefaultMemoryManager::DefaultMemoryManager |
( |
| ) |
|
|
inlinenoexcept |
◆ DefaultMemoryManager() [2/3]
◆ DefaultMemoryManager() [3/3]
◆ ~DefaultMemoryManager()
CppCommon::DefaultMemoryManager::~DefaultMemoryManager |
( |
| ) |
|
|
inlinenoexcept |
◆ allocated()
size_t CppCommon::DefaultMemoryManager::allocated |
( |
| ) |
const |
|
inlinenoexcept |
Allocated memory in bytes.
Definition at line 198 of file allocator.h.
◆ allocations()
size_t CppCommon::DefaultMemoryManager::allocations |
( |
| ) |
const |
|
inlinenoexcept |
Count of active memory allocations.
Definition at line 200 of file allocator.h.
◆ free()
void CppCommon::DefaultMemoryManager::free |
( |
void * |
ptr, |
|
|
size_t |
size |
|
) |
| |
|
inline |
Free the previously allocated memory block.
- Parameters
-
ptr | - Pointer to the memory block |
size | - Block size |
Definition at line 163 of file allocator.inl.
◆ malloc()
void * CppCommon::DefaultMemoryManager::malloc |
( |
size_t |
size, |
|
|
size_t |
alignment = alignof(std::max_align_t) |
|
) |
| |
|
inline |
Allocate a new memory block of the given size.
- Parameters
-
size | - Block size |
alignment | - Block alignment (default is alignof(std::max_align_t)) |
- Returns
- A pointer to the allocated memory block or nullptr in case of allocation failed
Definition at line 148 of file allocator.inl.
◆ max_size()
size_t CppCommon::DefaultMemoryManager::max_size |
( |
| ) |
const |
|
inlinenoexcept |
Maximum memory block size, that could be allocated by the memory manager.
Definition at line 203 of file allocator.h.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ reset()
void CppCommon::DefaultMemoryManager::reset |
( |
| ) |
|
|
inline |
The documentation for this class was generated from the following files: