This class implements the bdlma::ManagedAllocator protocol to provide an allocator 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 sized, from a separately managed list of memory blocks. Both the release method and the destructor of a bdlma::MultipoolAllocator release all memory currently allocated via the object.
Synopsis
Declared in <bdlma_multipoolallocator.h>
class MultipoolAllocator
: public ManagedAllocator
Base Classes
Name |
Description |
This protocol class extends |
Type Aliases
Name |
Description |
Alias for an unsigned integral type capable of representing the number of bytes in this platform's virtual address space. |
Member Functions
Name |
Description |
|
Constructors |
|
Destroy this multipool allocator. All memory allocated from this allocator is released. |
|
|
Return the memory block at the specified |
|
|
|
|
|
Return the maximum size of memory blocks that are pooled by this multipool allocator. Note that the maximum value is defined as: ` 2 ˆ (numPools + 2) ` where |
|
Return the number of pools managed by this multipool allocator. |
|
|
Release all memory currently allocated through this multipool allocator. |
Reserve memory from this multipool allocator to satisfy memory requests for at least the specified |
Static Member Functions
Name |
Description |
Throw |
Protected Member Functions
Name |
Description |
|
Return a newly allocated block of memory of (at least) the specified positive |
|
Return the memory block at the specified |
|
Return |
Created with MrDocs