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

Thread&hyphen;safe memory pool that allocates and manages uniformly sized blocks&period;

== Synopsis

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

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

== Description

This class implements a memory pool that allocates and manages memory blocks of some uniform size specified at construction&period; This memory pool maintains an internal linked list of free memory blocks, and dispenses one block for each `allocate` method invocation&period; When a memory block is deallocated, it is returned to the free list for potential reuse&period;

This class guarantees thread safety while allocating or releasing memory&period;

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlma/ConcurrentPool/2constructor-00.adoc[`ConcurrentPool`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/bdlma/ConcurrentPool/2destructor.adoc[`&#126;ConcurrentPool`] [.small]#[destructor]#
| Destroy this pool, releasing all associated memory back to the underlying allocator&period;
| xref:BloombergLP/bdlma/ConcurrentPool/allocate.adoc[`allocate`] 
| Return the address of a contiguous block of memory having the fixed block size specified at construction&period;
| xref:BloombergLP/bdlma/ConcurrentPool/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/ConcurrentPool/blockSize.adoc[`blockSize`] 
| Return the size (in bytes) of the memory blocks allocated from this pool object&period; Note that all blocks dispensed by this pool have the same size&period;
| xref:BloombergLP/bdlma/ConcurrentPool/deallocate.adoc[`deallocate`] 
| Relinquish the memory block at the specified `address` back to this pool for reuse&period;
| xref:BloombergLP/bdlma/ConcurrentPool/deleteObject.adoc[`deleteObject`] 
| Destroy and deallocate `object` using its dynamic type&period;
| xref:BloombergLP/bdlma/ConcurrentPool/deleteObjectRaw.adoc[`deleteObjectRaw`] 
| Destroy and deallocate `object` using its static type&period;
| xref:BloombergLP/bdlma/ConcurrentPool/release.adoc[`release`] 
| Relinquish all memory currently allocated via this pool object&period;
| xref:BloombergLP/bdlma/ConcurrentPool/reserveCapacity.adoc[`reserveCapacity`] 
| Reserve capacity for at least `numBlocks` blocks from this pool&period;
|===



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