Bullet Collision Detection & Physics Library: btAlignedAllocator.cpp File Reference

Bullet Collision Detection & Physics Library

Functions | Variables
btAlignedAllocator.cpp File Reference
`#include "btAlignedAllocator.h"`
Include dependency graph for btAlignedAllocator.cpp:

Go to the source code of this file.

## Functions
static void * | btAllocDefault (size_t size)
static void | btFreeDefault (void *ptr)
static void * | btAlignedAllocDefault (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...
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 More...
void | btAlignedFreeInternal (void *ptr)

## Variables
int | gNumAlignedAllocs = 0
int | gNumAlignedFree = 0
int | gTotalBytesAlignedAllocs = 0
static btAllocFunc * | sAllocFunc = btAllocDefault
static btFreeFunc * | sFreeFunc = btFreeDefault
static btAlignedAllocFunc * | sAlignedAllocFunc = btAlignedAllocDefault
static btAlignedFreeFunc * | sAlignedFreeFunc = btAlignedFreeDefault

## Function Documentation

## § btAlignedAllocDefault()

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

Definition at line 66 of file btAlignedAllocator.cpp.

## § 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 247 of file btAlignedAllocator.cpp.

## § 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 101 of file btAlignedAllocator.cpp.

## § 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 95 of file btAlignedAllocator.cpp.

## § btAlignedFreeDefault()

static void btAlignedFreeDefault | ( | void * | ptr | ) |
| inlinestatic

Definition at line 80 of file btAlignedAllocator.cpp.

## § btAlignedFreeInternal()

void btAlignedFreeInternal | ( | void * | ptr | ) |

Definition at line 256 of file btAlignedAllocator.cpp.

## § btAllocDefault()

static void* btAllocDefault | ( | size_t | size | ) |
| static

Definition at line 22 of file btAlignedAllocator.cpp.

## § btFreeDefault()

static void btFreeDefault | ( | void * | ptr | ) |
| static

Definition at line 27 of file btAlignedAllocator.cpp.

## Variable Documentation

## § gNumAlignedAllocs

int gNumAlignedAllocs = 0

Definition at line 18 of file btAlignedAllocator.cpp.

## § gNumAlignedFree

int gNumAlignedFree = 0

Definition at line 19 of file btAlignedAllocator.cpp.

## § gTotalBytesAlignedAllocs

int gTotalBytesAlignedAllocs = 0

Definition at line 20 of file btAlignedAllocator.cpp.

## § sAlignedAllocFunc

btAlignedAllocFunc* sAlignedAllocFunc = btAlignedAllocDefault
| static

Definition at line 92 of file btAlignedAllocator.cpp.

## § sAlignedFreeFunc

btAlignedFreeFunc* sAlignedFreeFunc = btAlignedFreeDefault
| static

Definition at line 93 of file btAlignedAllocator.cpp.

## § sAllocFunc

btAllocFunc* sAllocFunc = btAllocDefault
| static

Definition at line 32 of file btAlignedAllocator.cpp.

## § sFreeFunc

btFreeFunc* sFreeFunc = btFreeDefault
| static

Definition at line 33 of file btAlignedAllocator.cpp.