Torque2D Reference
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Static Public Member Functions | List of all members
FrameAllocator Class Reference

#include <frameAllocator.h>

Static Public Member Functions

static void init (const U32 frameSize)
 
static void destroy ()
 
static void * alloc (const U32 allocSize)
 
static void setWaterMark (const U32)
 
static U32 getWaterMark ()
 
static U32 getHighWaterMark ()
 

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);

Member Function Documentation

void * alloc ( const U32  allocSize)
inlinestatic
void destroy ( )
inlinestatic
U32 getHighWaterMark ( )
inlinestatic
U32 getWaterMark ( )
inlinestatic
void init ( const U32  frameSize)
inlinestatic
void setWaterMark ( const U32  waterMark)
inlinestatic

The documentation for this class was generated from the following files: