1 #ifndef Protium_FixedAllocator_h_
2 #define Protium_FixedAllocator_h_
83 void Initialize( std::size_t blockSize, std::size_t pageSize );
133 return const_cast< Chunk *
>(
143 #endif //File Guardian
bool TrimEmptyChunk(void)
void DoDeallocate(void *p)
FixedAllocator()
Create a FixedAllocator which manages blocks of 'blockSize' size.
Chunk * allocChunk_
Pointer to Chunk used for last or next allocation.
bool IsCorrupt(void) const
Pool of allocation chunks.
Chunks::iterator ChunkIter
Iterator through container of Chunks.
static unsigned char MaxObjectsPerChunk_
Most # of objects managed by a Chunk - never exceeds UCHAR_MAX.
Chunk * VicinityFind(void *p) const
FixedAllocator & operator=(const FixedAllocator &)
Not implemented.
std::size_t blockSize_
Number of bytes in a single block within a Chunk.
Chunk * emptyChunk_
Pointer to the only empty Chunk if there is one, else NULL.
Chunk * deallocChunk_
Pointer to Chunk used for last or next deallocation.
void Initialize(std::size_t blockSize, std::size_t pageSize)
Initializes a FixedAllocator by calculating # of blocks per Chunk.
bool Deallocate(void *p, Chunk *hint)
Chunks chunks_
Container of Chunks.
const Chunk * HasBlock(void *p) const
Represents a fixed number of blocks.
Chunk * HasBlock(void *p)
unsigned char numBlocks_
Number of blocks managed by each Chunk.
static unsigned char MinObjectsPerChunk_
Fewest # of objects managed by a Chunk.
std::size_t CountEmptyChunks(void) const
std::size_t BlockSize() const
Returns block size with which the FixedAllocator was initialized.
std::vector< Chunk > Chunks
Type of container used to hold Chunks.
~FixedAllocator()
Destroy the FixedAllocator and release all its Chunks.
Chunks::const_iterator ChunkCIter
Iterator through const container of Chunks.