Allocator that manages pools of memory blocks of varying sizes.
Synopsis
Declared in <bdlma_multipoolallocator.h>
class MultipoolAllocator
: public ManagedAllocator
Description
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.
Base Classes
Name |
Description |
Protocol for allocators that support releasing all allocated memory. |
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 a memory block to this allocator for reuse. |
|
|
|
|
|
Return the maximum size of memory blocks pooled by this allocator. |
|
Return the number of pools managed by this multipool allocator. |
|
|
Release all memory currently allocated through this multipool allocator. |
Reserve capacity for at least |
Static Member Functions
Name |
Description |
Throw |
Protected Member Functions
Name |
Description |
|
Return a newly allocated block of at least |
|
Return the memory block at |
|
Return whether this allocator can exchange memory with |
Created with MrDocs