torque Torque Game Engine Documentation
TGE Version 1.5.2

FrameAllocator Class Reference

#include <frameAllocator.h>


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


Static Public Member Functions

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

Static Private Attributes

static U8smBuffer
static U32 smHighWaterMark
static U32 smWaterMark


Member Function Documentation

void FrameAllocator::init ( const U32  frameSize  )  [inline, static]

void FrameAllocator::destroy (  )  [inline, static]

void * FrameAllocator::alloc ( const U32  allocSize  )  [inline, static]

void FrameAllocator::setWaterMark ( const   U32  )  [inline, static]

U32 FrameAllocator::getWaterMark (  )  [inline, static]

U32 FrameAllocator::getHighWaterMark (  )  [inline, static]


Field Documentation

U8* FrameAllocator::smBuffer [static, private]

U32 FrameAllocator::smWaterMark [static, private]




All Rights Reserved GarageGames.com, Inc. 1999-2005
Auto-magically Generated with Doxygen