Thread-safe allocator managing pools of varying block sizes.
Declared in <bdlma_concurrentmultipoolallocator.h>
class ConcurrentMultipoolAllocator
: public bdlma::ManagedAllocator
This class implements the bdlma::ManagedAllocator protocol to provide a thread-safe allocator that maintains a configurable number of Pool objects, each dispensing memory blocks of a unique size. The 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 sized, from a separately managed list of memory blocks. Both the release method and the destructor of a ConcurrentMultipoolAllocator release all memory currently allocated via the object.
| Name | Description |
|---|---|
bdlma::ManagedAllocator | Protocol for allocators that support releasing all allocated memory. |
| Name | Description |
|---|---|
size_type | Alias for an unsigned integral type capable of representing the number of bytes in this platform's virtual address space. |
| Name | Description |
|---|---|
ConcurrentMultipoolAllocator [constructor] | Constructors |
~ConcurrentMultipoolAllocator [destructor] [virtual] | Destroy this multipool allocator. All memory allocated from this allocator is released. |
operator= | |
allocate | allocate overloads |
deallocate | Return the memory block at address to this allocator for reuse. |
deleteObject | deleteObject overloads |
deleteObjectRaw | deleteObjectRaw overloads |
is_equal | |
maxPooledBlockSize | Return the maximum size of memory blocks pooled by this allocator. |
numPools | Return the number of pools managed by this multipool allocator. |
release [virtual] | Relinquish all memory currently allocated through this multipool allocator. |
reserveCapacity | Reserve capacity for at least numObjects objects of size bytes. |
| Name | Description |
|---|---|
throwBadAlloc | Throw std::bad_alloc or abort the program. |
| Name | Description |
|---|---|
do_allocate [virtual] | Return a newly allocated block of at least bytes with alignment. |
do_deallocate [virtual] | Return the memory block at p having bytes and alignment. |
do_is_equal [virtual] | Return whether this allocator can exchange memory with other. |