Recast Navigation
Navigation-mesh Toolset for Games
RecastAlloc.cpp File Reference
#include "RecastAlloc.h"

Functions

static void * rcAllocDefault (size_t size, rcAllocHint)
 
static void rcFreeDefault (void *ptr)
 
void rcAllocSetCustom (rcAllocFunc *allocFunc, rcFreeFunc *freeFunc)
 Sets the base custom allocation functions to be used by Recast. More...
 
void * rcAlloc (size_t size, rcAllocHint hint)
 Allocates a memory block. More...
 
void rcFree (void *ptr)
 Deallocates a memory block. More...
 

Variables

static rcAllocFuncsRecastAllocFunc = rcAllocDefault
 
static rcFreeFuncsRecastFreeFunc = rcFreeDefault
 

Function Documentation

◆ rcAlloc()

void* rcAlloc ( size_t  size,
rcAllocHint  hint 
)

Allocates a memory block.

Parameters
[in]sizeThe size, in bytes of memory, to allocate.
[in]hintA hint to the allocator on how long the memory is expected to be in use.
Returns
A pointer to the beginning of the allocated memory block, or null if the allocation failed.
See also
rcFree, rcAllocSetCustom

◆ rcAllocDefault()

static void* rcAllocDefault ( size_t  size,
rcAllocHint   
)
static

◆ rcAllocSetCustom()

void rcAllocSetCustom ( rcAllocFunc allocFunc,
rcFreeFunc freeFunc 
)

Sets the base custom allocation functions to be used by Recast.

Parameters
[in]allocFuncThe memory allocation function to be used by rcAlloc
[in]freeFuncThe memory de-allocation function to be used by rcFree
See also
rcAlloc, rcFree

◆ rcFree()

void rcFree ( void *  ptr)

Deallocates a memory block.

If ptr is NULL, this does nothing.

Warning
This function leaves the value of ptr unchanged. So it still points to the same (now invalid) location, and not to null.
Parameters
[in]ptrA pointer to a memory block previously allocated using rcAlloc.
See also
rcAlloc, rcAllocSetCustom

◆ rcFreeDefault()

static void rcFreeDefault ( void *  ptr)
static

Variable Documentation

◆ sRecastAllocFunc

rcAllocFunc* sRecastAllocFunc = rcAllocDefault
static

◆ sRecastFreeFunc

rcFreeFunc* sRecastFreeFunc = rcFreeDefault
static