[#BloombergLP-bdlma-BufferManager] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlma.adoc[bdlma]::BufferManager :relfileprefix: ../../ :mrdocs: Memory manager that dispenses heterogeneous blocks from an external buffer. == Synopsis Declared in `<bdlma_buffermanager.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class BufferManager; ---- == Description This class implements a buffer manager that dispenses heterogeneous blocks of memory (of varying, user‐specified sizes) from an external buffer whose address and size are optionally supplied at construction. If an allocation request exceeds the remaining free memory space in the external buffer, the allocation request returns 0 if `allocate` is used, or results in undefined behavior if `allocateRaw` is used. Note that in no event will the buffer manager attempt to deallocate the external buffer. == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlma/BufferManager/2constructor-0c6.adoc[`BufferManager`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bdlma/BufferManager/2destructor.adoc[`~BufferManager`] [.small]#[destructor]# | Destroy this buffer manager. | xref:BloombergLP/bdlma/BufferManager/alignmentStrategy.adoc[`alignmentStrategy`] | Return the alignment strategy passed to this object at construction. | xref:BloombergLP/bdlma/BufferManager/allocate.adoc[`allocate`] | Return a contiguous block of memory of the specified `size` (in bytes), or 0 on failure. | xref:BloombergLP/bdlma/BufferManager/allocateRaw.adoc[`allocateRaw`] | Return a contiguous block of memory of the specified `size` (in bytes). | xref:BloombergLP/bdlma/BufferManager/buffer.adoc[`buffer`] | Return an address providing modifiable access to the buffer currently managed by this object, or 0 if this object currently manages no buffer. | xref:BloombergLP/bdlma/BufferManager/bufferSize.adoc[`bufferSize`] | Return the size (in bytes) of the buffer currently managed by this object, or 0 if this object currently manages no buffer. | xref:BloombergLP/bdlma/BufferManager/calculateAlignmentOffsetFromSize.adoc[`calculateAlignmentOffsetFromSize`] | Return the alignment offset for `address` for an allocation of `size`. | xref:BloombergLP/bdlma/BufferManager/deleteObject.adoc[`deleteObject`] | Destroy the specified `object`. | xref:BloombergLP/bdlma/BufferManager/deleteObjectRaw.adoc[`deleteObjectRaw`] | Destroy the specified `object`. Note that memory associated with `object` is not deallocated because there is no `deallocate` method in `BufferManager`. | xref:BloombergLP/bdlma/BufferManager/expand.adoc[`expand`] | Expand the allocation at `address` to include the remaining buffer. | xref:BloombergLP/bdlma/BufferManager/hasSufficientCapacity.adoc[`hasSufficientCapacity`] | Return whether the buffer can allocate a block of the specified `size`. | xref:BloombergLP/bdlma/BufferManager/release.adoc[`release`] | Release all memory currently allocated through this buffer manager. | xref:BloombergLP/bdlma/BufferManager/replaceBuffer.adoc[`replaceBuffer`] | Replace the managed buffer with `newBuffer` of `newBufferSize`. | xref:BloombergLP/bdlma/BufferManager/reset.adoc[`reset`] | Reset this buffer manager to its default‐constructed state. | xref:BloombergLP/bdlma/BufferManager/truncate.adoc[`truncate`] | Truncate the allocation at `address` from `originalSize` to `newSize`. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#