60 const unsigned char& numBlocks) {
65 _pData_ =
new unsigned char[blockSize * numBlocks];
78 for (
unsigned char indexBlock = 0; indexBlock != numBlocks; p += blockSize) {
109 GUM_ASSERT(pDeallocatedBlock >=
_pData_);
112 unsigned char* toRelease =
static_cast< unsigned char*
>(pDeallocatedBlock);
115 GUM_ASSERT((toRelease -
_pData_) % blockSize == 0);
135 for (_Chunks_::iterator chunksIter =
_chunks_.begin();; ++chunksIter) {
147 if (chunksIter->_blocksAvailable_ > 0) {
158 bool chunk_found =
true;
163 std::ptrdiff_t offset = 0;
_Chunks_::iterator _deallocChunk_
Last Chunk used for a deallocation.
void deallocate(void *pDeallocatedBlock)
Deallocates a block.
unsigned char _numBlocks_
The maximum number of blocks a chunk can allocate.
std::size_t _blockSize_
Size of a memory block allocated.
_Chunks_::iterator _allocChunk_
Last Chunk used for an allocation.
void * allocate()
Allocates a block.
Headers of gum::FixedAllocator.
Inlines of gum::FixedAllocator.
gum is the global namespace for all aGrUM entities
Allocates objects of one given size.
unsigned char _firstAvailableBlock_
Holds the index of the first block available in this chunck.
void _deallocat_(void *p, const std::size_t &blockSize)
Deallocates a block of memory.
unsigned char * _pData_
Pointer to the managed memory itself.
void * _allocate_(const std::size_t &blockSize)
Allocates a block of memory.
void _init_(const std::size_t &blockSize, const unsigned char &numBlocks)
Initializes a Chunk object.
unsigned char _blocksAvailable_
Number of blocks available in this chunck.