Public Member Functions | Private Attributes | Static Private Attributes | List of all members
b2BlockAllocator Class Reference

#include <b2BlockAllocator.h>

Public Member Functions

voidAllocate (int32 size)
 Allocate memory. This will use b2Alloc if the size is larger than b2_maxBlockSize. More...
 
 b2BlockAllocator ()
 
void Clear ()
 
void Free (void *p, int32 size)
 Free memory. This will use b2Free if the size is larger than b2_maxBlockSize. More...
 
 ~b2BlockAllocator ()
 

Private Attributes

int32 m_chunkCount
 
b2Chunkm_chunks
 
int32 m_chunkSpace
 
b2Blockm_freeLists [b2_blockSizes]
 

Static Private Attributes

static uint8 s_blockSizeLookup [b2_maxBlockSize+1]
 
static bool s_blockSizeLookupInitialized
 
static int32 s_blockSizes [b2_blockSizes]
 

Detailed Description

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.

Constructor & Destructor Documentation

b2BlockAllocator::b2BlockAllocator ( )

Definition at line 55 of file b2BlockAllocator.cpp.

b2BlockAllocator::~b2BlockAllocator ( )

Definition at line 87 of file b2BlockAllocator.cpp.

Member Function Documentation

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.

Member Data Documentation

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
staticprivate

Definition at line 58 of file b2BlockAllocator.h.

bool b2BlockAllocator::s_blockSizeLookupInitialized
staticprivate

Definition at line 59 of file b2BlockAllocator.h.

int32 b2BlockAllocator::s_blockSizes
staticprivate
Initial value:
=
{
16,
32,
64,
96,
128,
160,
192,
224,
256,
320,
384,
448,
512,
640,
}

Definition at line 57 of file b2BlockAllocator.h.


The documentation for this class was generated from the following files:


mvsim
Author(s):
autogenerated on Fri May 7 2021 03:05:52