[#BloombergLP-bdlma-ConcurrentMultipool]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlma.adoc[bdlma]::ConcurrentMultipool
:relfileprefix: ../../
:mrdocs:

This class implements a memory manager that maintains a configurable number of `bdlma&colon;&colon;Pool` objects, each dispensing memory blocks of a unique size&period; The `Pool` objects are placed in an array, with each successive pool managing memory blocks of size twice that of the previous pool&period; 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&period; Both the `release` method and the destructor of a `bdema&colon;&colon;Multipool` release all memory currently allocated via the object&period;

== Synopsis

Declared in `&lt;bdlma&lowbar;concurrentmultipool&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class ConcurrentMultipool;
----

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlma/ConcurrentMultipool/2constructor-055.adoc[`ConcurrentMultipool`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/bdlma/ConcurrentMultipool/2destructor.adoc[`&#126;ConcurrentMultipool`] [.small]#[destructor]#
| Destroy this multipool&period; All memory allocated from this memory pool is released&period;
| xref:BloombergLP/bdlma/ConcurrentMultipool/allocate.adoc[`allocate`] 
| Return the address of a contiguous block of maximally&hyphen;aligned memory of (at least) the specified `size` (in bytes)&period; If `size &gt; maxPooledBlockSize()`, the memory allocation is managed directly by the underlying allocator, and will not be pooled, but will be deallocated when the `release` method is called, or when this object is destroyed&period; If `size` is 0, no memory is allocated and 0 is returned&period;
| xref:BloombergLP/bdlma/ConcurrentMultipool/allocator.adoc[`allocator`] 
| Return the allocator used by this object to allocate memory&period; Note that this allocator can not be used to deallocate memory allocated through this pool&period;
| xref:BloombergLP/bdlma/ConcurrentMultipool/deallocate.adoc[`deallocate`] 
| Relinquish the memory block at the specified `address` back to this multipool object for reuse&period; The behavior is undefined unless `address` is non&hyphen;zero, was allocated by this multipool object, and has not already been deallocated&period;
| xref:BloombergLP/bdlma/ConcurrentMultipool/deleteObject.adoc[`deleteObject`] 
| Destroy the specified `object` based on its dynamic type and then use this multipool object to deallocate its memory footprint&period; This method has no effect if `object` is 0&period; The behavior is undefined unless `object`, when cast appropriately to `void &ast;`, was allocated using this multipool object and has not already been deallocated&period; Note that `dynamic&lowbar;cast&lt;void &ast;&gt;(object)` is applied if `TYPE` is polymorphic, and `static&lowbar;cast&lt;void &ast;&gt;(object)` is applied otherwise&period;
| xref:BloombergLP/bdlma/ConcurrentMultipool/deleteObjectRaw.adoc[`deleteObjectRaw`] 
| Destroy the specified `object` and then use this multipool to deallocate its memory footprint&period; This method has no effect if `object` is 0&period; The behavior is undefined unless `object` is *not* a secondary base class pointer (i&period;e&period;, the address is (numerically) the same as when it was originally dispensed by this multipool), was allocated using this multipool, and has not already been deallocated&period;
| xref:BloombergLP/bdlma/ConcurrentMultipool/maxPooledBlockSize.adoc[`maxPooledBlockSize`] 
| Return the maximum size of memory blocks that are pooled by this multipool object&period; Note that the maximum value is defined as&colon; &grave; 2 &circ; (numPools &plus; 2) &grave; where `numPools` is either specified at construction, or an implementation&hyphen;defined value&period;
| xref:BloombergLP/bdlma/ConcurrentMultipool/numPools.adoc[`numPools`] 
| Return the number of pools managed by this multipool object&period;
| xref:BloombergLP/bdlma/ConcurrentMultipool/release.adoc[`release`] 
| Relinquish all memory currently allocated via this multipool object&period;
| xref:BloombergLP/bdlma/ConcurrentMultipool/reserveCapacity.adoc[`reserveCapacity`] 
| Reserve memory from this multipool to satisfy memory requests for at least the specified `numBlocks` having the specified `size` (in bytes) before the pool replenishes&period; If `size` is 0, this method has no effect&period; The behavior is undefined unless `size &lt;&equals; maxPooledBlockSize()` and `0 &lt;&equals; numBlocks`&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
