#include <b2BlockAllocator.h>
Public Member Functions | |
void * | Allocate (int32 size) |
Allocate memory. This will use b2Alloc if the size is larger than b2_maxBlockSize. | |
b2BlockAllocator () | |
void | Clear () |
void | Free (void *p, int32 size) |
Free memory. This will use b2Free if the size is larger than b2_maxBlockSize. | |
~b2BlockAllocator () | |
Private Attributes | |
int32 | m_chunkCount |
b2Chunk * | m_chunks |
int32 | m_chunkSpace |
b2Block * | m_freeLists [b2_blockSizes] |
Static Private Attributes | |
static uint8 | s_blockSizeLookup [b2_maxBlockSize+1] |
static bool | s_blockSizeLookupInitialized |
static int32 | s_blockSizes [b2_blockSizes] |
This is a small object allocator used for allocating small objects that persist for more than one time step. See: http://www.codeproject.com/useritems/Small_Block_Allocator.asp
Definition at line 35 of file b2BlockAllocator.h.
Definition at line 55 of file b2BlockAllocator.cpp.
Definition at line 87 of file b2BlockAllocator.cpp.
void * b2BlockAllocator::Allocate | ( | int32 | size | ) |
Allocate memory. This will use b2Alloc if the size is larger than b2_maxBlockSize.
Definition at line 97 of file b2BlockAllocator.cpp.
void b2BlockAllocator::Clear | ( | ) |
Definition at line 204 of file b2BlockAllocator.cpp.
void b2BlockAllocator::Free | ( | void * | p, |
int32 | size | ||
) |
Free memory. This will use b2Free if the size is larger than b2_maxBlockSize.
Definition at line 155 of file b2BlockAllocator.cpp.
int32 b2BlockAllocator::m_chunkCount [private] |
Definition at line 52 of file b2BlockAllocator.h.
b2Chunk* b2BlockAllocator::m_chunks [private] |
Definition at line 51 of file b2BlockAllocator.h.
int32 b2BlockAllocator::m_chunkSpace [private] |
Definition at line 53 of file b2BlockAllocator.h.
b2Block* b2BlockAllocator::m_freeLists[b2_blockSizes] [private] |
Definition at line 55 of file b2BlockAllocator.h.
uint8 b2BlockAllocator::s_blockSizeLookup [static, private] |
Definition at line 58 of file b2BlockAllocator.h.
bool b2BlockAllocator::s_blockSizeLookupInitialized [static, private] |
Definition at line 59 of file b2BlockAllocator.h.
int32 b2BlockAllocator::s_blockSizes [static, private] |
{ 16, 32, 64, 96, 128, 160, 192, 224, 256, 320, 384, 448, 512, 640, }
Definition at line 57 of file b2BlockAllocator.h.