Triton
Visual simulation library for ocean rendering.
Public Member Functions | Static Public Member Functions | List of all members
Triton::Allocator Class Reference

You may extend the Allocator class to hook your own memory management scheme into Triton. More...

#include <MemAlloc.h>

Collaboration diagram for Triton::Allocator:
Collaboration graph
[legend]

Public Member Functions

virtual void *TRITONAPI alloc (size_t bytes)
 Allocate a block of memory; defaults to malloc()
 
virtual void TRITONAPI dealloc (void *p)
 Free a block of memory; defaults to free()
 

Static Public Member Functions

static Allocator *TRITONAPI GetAllocator ()
 Retrieves the static allocator object.
 
static void TRITONAPI SetAllocator (Allocator *a)
 Sets a new static allocator object.
 

Detailed Description

You may extend the Allocator class to hook your own memory management scheme into Triton.

Instantiate your own implementation of Allocator, and pass it into Allocator::SetAllocator prior to calling any other Triton methods or instantiating any Triton objects.

Each object in Triton overloads the new and delete operators, and routes memory management through the Allocator as well.

Member Function Documentation

◆ SetAllocator()

static void TRITONAPI Triton::Allocator::SetAllocator ( Allocator a)
inlinestatic

Sets a new static allocator object.

If this is not called, the default implementation using malloc and free is used.


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