FrameAllocator

Engine/source/core/frameAllocator.h

Temporary memory pool for per-frame allocations.

More...

Private Static Attributes

Public Static Functions

Detailed Description

Temporary memory pool for per-frame allocations.

In the course of rendering a frame, it is often necessary to allocate many small chunks of memory, then free them all in a batch. For instance, say we're allocating storage for some vertex calculations:

// Get FrameAllocator memory...
U32 waterMark = FrameAllocator::getWaterMark();
F32 * ptr = (F32*)FrameAllocator::alloc(sizeof(F32)*2*targetMesh->vertsPerFrame);

... calculations ...

// Free frameAllocator memory
FrameAllocator::setWaterMark(waterMark);

Private Static Attributes

U8 * smBuffer 
U32 smHighWaterMark 
U32 smWaterMark 

Public Static Functions

alloc(const U32 allocSize)

destroy()

getHighWaterMark()

getWaterMark()

init(const U32 frameSize)

setWaterMark(const U32)