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

Bullet Collision Detection & Physics Library

Classes | Macros | Typedefs | Functions
btAlignedAllocator.h File Reference
`#include "btScalar.h"`
Include dependency graph for btAlignedAllocator.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Classes
class | btAlignedAllocator< T, Alignment >
| The btAlignedAllocator is a portable class for aligned memory allocations. More...
struct | btAlignedAllocator< T, Alignment >::rebind< O >

## Macros
#define | btAlignedAlloc(size, alignment) btAlignedAllocInternal(size, alignment)
#define | btAlignedFree(ptr) btAlignedFreeInternal(ptr)

## Typedefs
typedef int | size_type
typedef void *() | btAlignedAllocFunc(size_t size, int alignment)
typedef void() | btAlignedFreeFunc(void *memblock)
typedef void *() | btAllocFunc(size_t size)
typedef void() | btFreeFunc(void *memblock)

## Functions
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)
void | btAlignedAllocSetCustom (btAllocFunc *allocFunc, btFreeFunc *freeFunc)
| The developer can let all Bullet memory allocations go through a custom memory allocator, using btAlignedAllocSetCustom. More...
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...

## Macro Definition Documentation

## ◆ btAlignedAlloc

#define btAlignedAlloc | ( |  | size,
|  |  | alignment
| ) |  | btAlignedAllocInternal(size, alignment)

Definition at line 46 of file btAlignedAllocator.h.

## ◆ btAlignedFree

#define btAlignedFree | ( |  | ptr | ) | btAlignedFreeInternal(ptr)

Definition at line 47 of file btAlignedAllocator.h.

## Typedef Documentation

## ◆ btAlignedAllocFunc

typedef void *() btAlignedAllocFunc(size_t size, int alignment)

Definition at line 52 of file btAlignedAllocator.h.

## ◆ btAlignedFreeFunc

typedef void() btAlignedFreeFunc(void *memblock)

Definition at line 53 of file btAlignedAllocator.h.

## ◆ btAllocFunc

typedef void *() btAllocFunc(size_t size)

Definition at line 54 of file btAlignedAllocator.h.

## ◆ btFreeFunc

typedef void() btFreeFunc(void *memblock)

Definition at line 55 of file btAlignedAllocator.h.

## ◆ size_type

typedef int size_type

Definition at line 50 of file btAlignedAllocator.h.

## Function Documentation

## ◆ 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 249 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 105 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 99 of file btAlignedAllocator.cpp.

## ◆ btAlignedFreeInternal()

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

Definition at line 257 of file btAlignedAllocator.cpp.