Blender  V3.3
Functions | Variables
btAlignedAllocator.cpp File Reference
#include "btAlignedAllocator.h"

Go to the source code of this file.

Functions

static voidbtAllocDefault (size_t size)
 
static void btFreeDefault (void *ptr)
 
static voidbtAlignedAllocDefault (size_t size, int alignment)
 
static void btAlignedFreeDefault (void *ptr)
 
void btAlignedAllocSetCustomAligned (btAlignedAllocFunc *allocFunc, btAlignedFreeFunc *freeFunc)
 If the developer has already an custom aligned allocator, then btAlignedAllocSetCustomAligned can be used. The default aligned allocator pre-allocates extra memory using the non-aligned allocator, and instruments it. More...
 
void btAlignedAllocSetCustom (btAllocFunc *allocFunc, btFreeFunc *freeFunc)
 The developer can let all Bullet memory allocations go through a custom memory allocator, using btAlignedAllocSetCustom. More...
 
voidbtAlignedAllocInternal (size_t size, int alignment)
 
void btAlignedFreeInternal (void *ptr)
 

Variables

static btAllocFuncsAllocFunc = btAllocDefault
 
static btFreeFuncsFreeFunc = btFreeDefault
 
static btAlignedAllocFuncsAlignedAllocFunc = btAlignedAllocDefault
 
static btAlignedFreeFuncsAlignedFreeFunc = btAlignedFreeDefault
 

Function Documentation

◆ btAlignedAllocDefault()

static void* btAlignedAllocDefault ( size_t  size,
int  alignment 
)
inlinestatic

Definition at line 62 of file btAlignedAllocator.cpp.

References btAlignPointer(), ret, sAllocFunc, and size().

Referenced by btAlignedAllocSetCustomAligned().

◆ btAlignedAllocInternal()

void* btAlignedAllocInternal ( size_t  size,
int  alignment 
)

we probably replace this with our own aligned memory allocator so we replace _aligned_malloc and _aligned_free with our own that is better portable and more predictable BT_DEBUG_MEMORY_ALLOCATIONS preprocessor can be set in build system for regression tests to detect memory leaks define BT_DEBUG_MEMORY_ALLOCATIONS 1

Definition at line 244 of file btAlignedAllocator.cpp.

References ptr, sAlignedAllocFunc, and size().

◆ btAlignedAllocSetCustom()

void btAlignedAllocSetCustom ( btAllocFunc allocFunc,
btFreeFunc freeFunc 
)

The developer can let all Bullet memory allocations go through a custom memory allocator, using btAlignedAllocSetCustom.

Definition at line 100 of file btAlignedAllocator.cpp.

References btAllocDefault(), btFreeDefault(), sAllocFunc, and sFreeFunc.

◆ btAlignedAllocSetCustomAligned()

void btAlignedAllocSetCustomAligned ( btAlignedAllocFunc allocFunc,
btAlignedFreeFunc freeFunc 
)

If the developer has already an custom aligned allocator, then btAlignedAllocSetCustomAligned can be used. The default aligned allocator pre-allocates extra memory using the non-aligned allocator, and instruments it.

Definition at line 94 of file btAlignedAllocator.cpp.

References btAlignedAllocDefault(), btAlignedFreeDefault(), sAlignedAllocFunc, and sAlignedFreeFunc.

◆ btAlignedFreeDefault()

static void btAlignedFreeDefault ( void ptr)
inlinestatic

Definition at line 79 of file btAlignedAllocator.cpp.

References ptr, and sFreeFunc.

Referenced by btAlignedAllocSetCustomAligned().

◆ btAlignedFreeInternal()

void btAlignedFreeInternal ( void ptr)

Definition at line 252 of file btAlignedAllocator.cpp.

References ptr, and sAlignedFreeFunc.

◆ btAllocDefault()

static void* btAllocDefault ( size_t  size)
static

Definition at line 24 of file btAlignedAllocator.cpp.

References size().

Referenced by btAlignedAllocSetCustom().

◆ btFreeDefault()

static void btFreeDefault ( void ptr)
static

Definition at line 29 of file btAlignedAllocator.cpp.

References free(), and ptr.

Referenced by btAlignedAllocSetCustom().

Variable Documentation

◆ sAlignedAllocFunc

btAlignedAllocFunc* sAlignedAllocFunc = btAlignedAllocDefault
static

◆ sAlignedFreeFunc

btAlignedFreeFunc* sAlignedFreeFunc = btAlignedFreeDefault
static

Definition at line 92 of file btAlignedAllocator.cpp.

Referenced by btAlignedAllocSetCustomAligned(), and btAlignedFreeInternal().

◆ sAllocFunc

btAllocFunc* sAllocFunc = btAllocDefault
static

Definition at line 34 of file btAlignedAllocator.cpp.

Referenced by btAlignedAllocDefault(), and btAlignedAllocSetCustom().

◆ sFreeFunc

btFreeFunc* sFreeFunc = btFreeDefault
static

Definition at line 35 of file btAlignedAllocator.cpp.

Referenced by btAlignedAllocSetCustom(), and btAlignedFreeDefault().