Memory manager that maintains a configurable number of size-tiered pools.
Declared in <bdlma_multipool.h>
class Multipool;
This class implements a memory manager that maintains a configurable number of bdlma::Pool objects, each dispensing memory blocks of a unique size. The bdlma::Pool objects are placed in an array, with each successive pool managing memory blocks of size twice that of the previous pool. Each multipool allocation (deallocation) request allocates memory from (returns memory to) the internal pool having the smallest block size not less than the requested size, or, if no pool manages memory blocks of sufficient size, from a separately managed list of memory blocks. Both the release method and the destructor of a bdlma::Multipool release all memory currently allocated via the object.
| Name | Description |
|---|---|
Multipool [constructor] | Constructors |
~Multipool [destructor] | Destroy this multipool. All memory allocated from this memory pool is released. |
allocate | Return a contiguous block of maximally-aligned memory of at least size. |
allocator | Return the allocator used by this object to allocate memory. Note that this allocator can not be used to deallocate memory allocated through this pool. |
deallocate | Relinquish the memory block at address back to this multipool. |
deleteObject | Destroy and deallocate object using its dynamic type. |
deleteObjectRaw | Destroy and deallocate object using its static type. |
maxPooledBlockSize | Return the maximum size of memory blocks pooled by this multipool. |
numPools | Return the number of pools managed by this multipool object. |
release | Relinquish all memory currently allocated via this multipool object. |
reserveCapacity | Reserve capacity for at least numBlocks blocks of the specified size. |