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

#include <b2_block_allocator.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_blockSizeCount]
 

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 37 of file b2_block_allocator.h.

Constructor & Destructor Documentation

◆ b2BlockAllocator()

b2BlockAllocator::b2BlockAllocator ( )

Definition at line 89 of file b2_block_allocator.cpp.

◆ ~b2BlockAllocator()

b2BlockAllocator::~b2BlockAllocator ( )

Definition at line 101 of file b2_block_allocator.cpp.

Member Function Documentation

◆ Allocate()

void * b2BlockAllocator::Allocate ( int32  size)

Allocate memory. This will use b2Alloc if the size is larger than b2_maxBlockSize.

Definition at line 111 of file b2_block_allocator.cpp.

◆ Clear()

void b2BlockAllocator::Clear ( )

Definition at line 220 of file b2_block_allocator.cpp.

◆ Free()

void b2BlockAllocator::Free ( void p,
int32  size 
)

Free memory. This will use b2Free if the size is larger than b2_maxBlockSize.

Definition at line 171 of file b2_block_allocator.cpp.

Member Data Documentation

◆ m_chunkCount

int32 b2BlockAllocator::m_chunkCount
private

Definition at line 54 of file b2_block_allocator.h.

◆ m_chunks

b2Chunk* b2BlockAllocator::m_chunks
private

Definition at line 53 of file b2_block_allocator.h.

◆ m_chunkSpace

int32 b2BlockAllocator::m_chunkSpace
private

Definition at line 55 of file b2_block_allocator.h.

◆ m_freeLists

b2Block* b2BlockAllocator::m_freeLists[b2_blockSizeCount]
private

Definition at line 57 of file b2_block_allocator.h.


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


mvsim
Author(s):
autogenerated on Tue Jul 4 2023 03:08:22