![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
Allocates objects of one given size. More...
Public Member Functions | |
| void | _init_ (const std::size_t &blockSize, const unsigned char &numBlocks) |
| Initializes a Chunk object. | |
| void * | _allocate_ (const std::size_t &blockSize) |
| Allocates a block of memory. | |
| void | _deallocat_ (void *p, const std::size_t &blockSize) |
| Deallocates a block of memory. | |
| void | _release_ () |
| Releases the allocated memory. | |
Public Attributes | |
| unsigned char * | _pData_ |
| Pointer to the managed memory itself. | |
| unsigned char | _firstAvailableBlock_ |
| Holds the index of the first block available in this chunck. | |
| unsigned char | _blocksAvailable_ |
| Number of blocks available in this chunck. | |
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 102 of file fixedAllocator.h.
| INLINE void * gum::FixedAllocator::_Chunk_::_allocate_ | ( | const std::size_t & | blockSize | ) |
Allocates a block of memory.
Definition at line 87 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 113 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 61 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 141 of file fixedAllocator_inl.h.
References _pData_.
| unsigned char gum::FixedAllocator::_Chunk_::_blocksAvailable_ |
Number of blocks available in this chunck.
Definition at line 136 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 131 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 126 of file fixedAllocator.h.
Referenced by _allocate_(), _deallocat_(), _init_(), and _release_().