Memory pool for small objects.The memory pool efficiently improves the performance of dynamic memory allocations for small objects. By allocating a large block of memory that can be dynamically assigned to small objects, the memory allocation is reduced from a few hundred cycles to only a few cycles.
The memory pool is build from memory blocks of type Block, which hold the memory for a specified number of objects. The memory of these blocks is managed as a single free list.
More...
#include <MemoryPool.h>
Inherits blaze::NonCopyable.
|
void * | malloc () |
| Allocation of raw memory for an object of type Type. More...
|
|
void | free (void *rawMemory) |
| Deallocation of raw memory for an object of type Type. More...
|
|
bool | checkMemory (FreeObject *rawMemory) const |
| Performing a number of checks on the memory to be released. More...
|
|
template<typename Type, size_t Blocksize>
class blaze::MemoryPool< Type, Blocksize >
Memory pool for small objects.
The memory pool efficiently improves the performance of dynamic memory allocations for small objects. By allocating a large block of memory that can be dynamically assigned to small objects, the memory allocation is reduced from a few hundred cycles to only a few cycles.
The memory pool is build from memory blocks of type Block, which hold the memory for a specified number of objects. The memory of these blocks is managed as a single free list.
◆ checkMemory()
template<typename Type , size_t Blocksize>
Performing a number of checks on the memory to be released.
- Parameters
-
toRelease | Pointer to the memory to be released. |
- Returns
- true if the memory check succeeds, false if an error is encountered.
◆ free()
template<typename Type , size_t Blocksize>
Deallocation of raw memory for an object of type Type.
- Parameters
-
rawMemory | Pointer to the raw memory. |
- Returns
- void
◆ malloc()
template<typename Type , size_t Blocksize>
Allocation of raw memory for an object of type Type.
- Returns
- Pointer to the raw memory.
The documentation for this class was generated from the following file: