class MemStackInternal::MemBlock

A single block of memory of BlockCapacity size.

A pointer to the first free address is stored, and a remaining size.

Public

Constructors

MemBlock

MemBlock(u32 size)

Methods

~MemBlock

~MemBlock() = default

Alloc

u8 *Alloc(u32 amount)

Returns the first free address and increments the free pointer.

Caller needs to ensure the remaining block size is adequate before calling.

Dealloc

void Dealloc(u8 *data, u32 amount)

Deallocates the provided pointer.

Deallocation must happen in opposite order from allocation otherwise corruption will occur.

Fields

MData

u8 * MData

MFreePtr

u32 MFreePtr

MSize

u32 MSize

MNextBlock

MemBlock * MNextBlock

MPrevBlock

MemBlock * MPrevBlock