[#BloombergLP-bdlma-ConcurrentPool] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlma.adoc[bdlma]::ConcurrentPool :relfileprefix: ../../ :mrdocs: This class implements a memory pool that allocates and manages memory blocks of some uniform size specified at construction. This memory pool maintains an internal linked list of free memory blocks, and dispenses one block for each `allocate` method invocation. When a memory block is deallocated, it is returned to the free list for potential reuse. == Synopsis Declared in `<bdlma_concurrentpool.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class ConcurrentPool; ---- == Description This class guarantees thread safety while allocating or releasing memory. == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlma/ConcurrentPool/2constructor-00.adoc[`ConcurrentPool`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bdlma/ConcurrentPool/2destructor.adoc[`~ConcurrentPool`] [.small]#[destructor]# | Destroy this pool, releasing all associated memory back to the underlying allocator. | xref:BloombergLP/bdlma/ConcurrentPool/allocate.adoc[`allocate`] | Return the address of a contiguous block of memory having the fixed block size specified at construction. | xref:BloombergLP/bdlma/ConcurrentPool/allocator.adoc[`allocator`] | Return the allocator used by this object to allocate memory. Note that this allocator can not be used to deallocate memory allocated through this pool. | xref:BloombergLP/bdlma/ConcurrentPool/blockSize.adoc[`blockSize`] | Return the size (in bytes) of the memory blocks allocated from this pool object. Note that all blocks dispensed by this pool have the same size. | xref:BloombergLP/bdlma/ConcurrentPool/deallocate.adoc[`deallocate`] | Relinquish the memory block at the specified `address` back to this pool object for reuse. The behavior is undefined unless `address` is non‐zero, was allocated by this pool, and has not already been deallocated. | xref:BloombergLP/bdlma/ConcurrentPool/deleteObject.adoc[`deleteObject`] | Destroy the specified `object` based on its dynamic type and then use this pool to deallocate its memory footprint. This method has no effect if `object` is 0. The behavior is undefined unless `object`, when cast appropriately to `void *`, was allocated using this pool and has not already been deallocated. Note that `dynamic_cast<void *>(object)` is applied if `TYPE` is polymorphic, and `static_cast<void *>(object)` is applied otherwise. | xref:BloombergLP/bdlma/ConcurrentPool/deleteObjectRaw.adoc[`deleteObjectRaw`] | Destroy the specified `object` and then use this pool to deallocate its memory footprint. This method has no effect if `object` is 0. The behavior is undefined unless `object` is *not* a secondary base class pointer (i.e., the address is (numerically) the same as when it was originally dispensed by this pool), was allocated using this pool, and has not already been deallocated. | xref:BloombergLP/bdlma/ConcurrentPool/release.adoc[`release`] | Relinquish all memory currently allocated via this pool object. | xref:BloombergLP/bdlma/ConcurrentPool/reserveCapacity.adoc[`reserveCapacity`] | Reserve memory from this pool to satisfy memory requests for at least the specified `numBlocks` before the pool replenishes. The behavior is undefined unless `0 <= numBlocks`. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#