class
MemStackInternal
template<int BlockCapacity = 1024 * 1024>Describes a memory stack of a certain block capacity.
See MemStack for more information.
Template parameters
BlockCapacity | Minimum size of a block. Larger blocks mean less memory allocations, but also potentially more wasted memory. If an allocation requests more bytes than BlockCapacity, first largest multiple is used instead. |
|---|
Public
Constructors
MemStackInternal<BlockCapacity>
MemStackInternal<BlockCapacity>()
Methods
~MemStackInternal<BlockCapacity>
~MemStackInternal<BlockCapacity>()
Alloc
u8 *Alloc(u32 amount)
Allocates the given amount of memory on the stack.
- amount
- The amount to allocate in bytes.
Dealloc
void Dealloc(u8 *data)
Deallocates the given memory.
Data must be deallocated in opposite order then when it was allocated.
Private
Methods
AllocBlock
MemBlock *AllocBlock(u32 wantedSize)
Allocates a new block of memory using a heap allocator.
Block will never be smaller than BlockCapacity no matter the .
Fields
mFreeBlock
MemBlock * mFreeBlock