DCSModulesAPI
1.0.0
DCS sub project containing all the control modules as libraries.
|
Linearly allocates memory for a single use. More...
#include <DCS_ModuleCore.h>
Public Member Functions | |
LinearAllocator (u64 size, u64 align) | |
Creates a new LinearAllocator. More... | |
template<typename T , typename... Args> | |
T * | allocate (Args...args) |
Allocates a new section of the pool for a new type T. More... | |
template<typename T > | |
T * | allocate () |
Allocates a new section of the pool for a new type T. More... | |
void | release () |
Free all the linear allocated memory of the buffer. More... | |
void | reset () |
Invalidate all pool data. Return buffer pointer to start. More... | |
Linearly allocates memory for a single use.
Can be reused upon reset. Can't be realoc'ed.
Creates a new LinearAllocator.
size | Size of the linear pool to alocate |
align | Align the data to align-bits. (Currently disabled.) |
|
inline |
Allocates a new section of the pool for a new type T.
T | Type to allocate. |
args | Arguments to the costructor of T. |
|
inline |
Allocates a new section of the pool for a new type T.
T | Type to allocate. |
void DCS::Memory::LinearAllocator::release | ( | ) |
Free all the linear allocated memory of the buffer.
This invalidates the buffer data.
void DCS::Memory::LinearAllocator::reset | ( | ) |
Invalidate all pool data. Return buffer pointer to start.
Effectively setting memory usage to zero.