Torque2D Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

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 | ) |
| inline static

void destroy | ( |  | ) |
| inline static

U32 getHighWaterMark | ( |  | ) |
| inline static

U32 getWaterMark | ( |  | ) |
| inline static

void init | ( | const U32 | frameSize | ) |
| inline static

void setWaterMark | ( | const U32 | waterMark | ) |
| inline static

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

- memory/frameAllocator.h