ug4
|
#include <small_object_allocator.h>
Classes | |
struct | Chunk |
Public Member Functions | |
void * | allocate () |
void | deallocate (void *p) |
FixedAllocator (std::size_t blockSize, unsigned char numBlocksPerChunk) | |
Private Types | |
typedef std::vector< Chunk > | Chunks |
Private Member Functions | |
bool | pointer_is_in_chunk (void *p, Chunk *chunk) |
Private Attributes | |
Chunk * | m_allocChunk |
std::size_t | m_blockSize |
Chunks | m_chunks |
int | m_deallocChunkIndex |
int | m_emptyChunkIndex |
unsigned char | m_numBlocksPerChunk |
std::size_t | m_numFreeBlocks |
Instances of this class can be used to allocate small objects of the same size in a highly efficient way.
|
private |
FixedAllocator::FixedAllocator | ( | std::size_t | blockSize, |
unsigned char | numBlocksPerChunk | ||
) |
void * FixedAllocator::allocate | ( | ) |
void FixedAllocator::deallocate | ( | void * | p | ) |
|
inlineprivate |
References m_blockSize, m_numBlocksPerChunk, FixedAllocator::Chunk::m_pData, and p.
Referenced by deallocate().
|
private |
Referenced by allocate().
|
private |
Referenced by allocate(), deallocate(), and pointer_is_in_chunk().
|
private |
Referenced by allocate(), and deallocate().
|
private |
Referenced by allocate(), and deallocate().
|
private |
Referenced by deallocate().
|
private |
Referenced by allocate(), deallocate(), and pointer_is_in_chunk().
|
private |
Referenced by allocate(), and deallocate().