sipxportlib
Version 3.3
|
Pool of available objects derived from UtlChain. More...
#include <UtlChainPool.h>
Protected Types | |
typedef void | allocator(size_t blocksize, UtlChain *blockList, UtlChain *pool) |
Allocate blocksize instances of the subclass and chain them into the pool. More... | |
Protected Member Functions | |
UtlChainPool (allocator *blockAllocator, size_t blockSize) | |
Create a UtlChainPool that uses blockAllocator to create UtlChain derived objects. More... | |
UtlChain * | get () |
Get a UtlLink with chain pointers NULL. More... | |
void | release (UtlChain *freeChain) |
Return freeLink to the pool of available UtlLinks. More... | |
size_t | totalAllocated () |
Returns the total number of subclasses instances allocated by this pool. More... | |
Friends | |
class | UtlLink |
class | UtlPair |
class | UtlInit |
Pool of available objects derived from UtlChain.
This avoids excessive heap operations; rather than delete unused UtlChains, they are stored on the mPool here. To limit the heap overhead associated with allocating UtlChain, they are allocated in mBlockSize blocks, which are chained on mBlocks.
The actual allocation of the blocks and initial chaining is done by the allocator function supplied by the UtlChain subclass.
Allocate blocksize instances of the subclass and chain them into the pool.
This function is supplied by the subclass to the UtlChainPool constructor. It is responsible for allocating a block of blocksize instances of its subclass. The first instance in each block is added to the blockList, so that the UtlChainPool destructor can delete the block. The remaining (blocksize-1) instances are chained onto the pool list header.
|
protected |
Create a UtlChainPool that uses blockAllocator to create UtlChain derived objects.
|
protected |
Return freeLink to the pool of available UtlLinks.
|
inlineprotected |
Returns the total number of subclasses instances allocated by this pool.
The returned count does not include the 1 instance in each allocation that is consumed to manage the pool.
|
friend |
|
friend |
|
friend |