![]() |
aGrUM
0.16.0
|
Allocates objects of one given size. More...
Public Attributes | |
unsigned char * | __pData |
Pointer to the managed memory itself. More... | |
unsigned char | __firstAvailableBlock |
Holds the index of the first block available in this chunck. More... | |
unsigned char | __blocksAvailable |
Number of blocks available in this chunck. More... | |
Public Member Functions | |
void | __init (const std::size_t &blockSize, const unsigned char &numBlocks) |
Initializes a Chunk object. More... | |
void * | __allocate (const std::size_t &blockSize) |
Allocates a block of memory. More... | |
void | __deallocat (void *p, const std::size_t &blockSize) |
Deallocates a block of memory. More... | |
void | __release () |
Releases the allocated memory. More... | |
Allocates objects of one given size.
Has a fixed limit of allocation
Each object of type Chunk contains and manages a chunk of memory containing a amount of blocks. At construction time, you configure the block size and the number of blocks. A Chunk contains logic that allows you to allocate and deallocate memory blocks from that chunk of memory. When there are no more blocks available in the chunk, the allocation function returns zero.
Definition at line 80 of file fixedAllocator.h.
INLINE void * gum::FixedAllocator::__Chunk::__allocate | ( | const std::size_t & | blockSize | ) |
Allocates a block of memory.
Definition at line 65 of file fixedAllocator_inl.h.
References __blocksAvailable, __firstAvailableBlock, and __pData.
INLINE void gum::FixedAllocator::__Chunk::__deallocat | ( | void * | p, |
const std::size_t & | blockSize | ||
) |
Deallocates a block of memory.
Definition at line 91 of file fixedAllocator_inl.h.
References __blocksAvailable, __firstAvailableBlock, and __pData.
INLINE void gum::FixedAllocator::__Chunk::__init | ( | const std::size_t & | blockSize, |
const unsigned char & | numBlocks | ||
) |
Initializes a Chunk object.
Definition at line 39 of file fixedAllocator_inl.h.
References __blocksAvailable, __firstAvailableBlock, and __pData.
Referenced by gum::FixedAllocator::allocate().
INLINE void gum::FixedAllocator::__Chunk::__release | ( | ) |
Releases the allocated memory.
Definition at line 120 of file fixedAllocator_inl.h.
References __pData.
unsigned char gum::FixedAllocator::__Chunk::__blocksAvailable |
Number of blocks available in this chunck.
Definition at line 114 of file fixedAllocator.h.
Referenced by __allocate(), __deallocat(), and __init().
unsigned char gum::FixedAllocator::__Chunk::__firstAvailableBlock |
Holds the index of the first block available in this chunck.
Definition at line 109 of file fixedAllocator.h.
Referenced by __allocate(), __deallocat(), and __init().
unsigned char* gum::FixedAllocator::__Chunk::__pData |
Pointer to the managed memory itself.
Definition at line 104 of file fixedAllocator.h.
Referenced by __allocate(), __deallocat(), __init(), __release(), and gum::FixedAllocator::deallocate().