[#BloombergLP-bdlma-BufferedSequentialPool] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlma.adoc[bdlma]::BufferedSequentialPool :relfileprefix: ../../ :mrdocs: Fast memory pool dispensing blocks from an external buffer. == Synopsis Declared in `<bdlma_bufferedsequentialpool.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class BufferedSequentialPool; ---- == Description This class implements a fast memory pool that efficiently dispenses heterogeneous blocks of memory (of varying, user‐specified sizes) from an external buffer whose address and size (in bytes) are supplied at construction. If an allocation request exceeds the remaining free memory space in the external buffer, memory will be supplied by an (optional) allocator supplied also at construction; if no allocator is supplied, the currently installed default allocator will be used. This class is _exception_ _neutral_: If memory cannot be allocated, the behavior is defined by the (optional) allocator supplied at construction. Note that in no case will the buffered sequential pool attempt to deallocate the external buffer. == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlma/BufferedSequentialPool/2constructor-0ad.adoc[`BufferedSequentialPool`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bdlma/BufferedSequentialPool/2destructor.adoc[`~BufferedSequentialPool`] [.small]#[destructor]# | Destroy this buffered sequential pool. All memory allocated from this pool is released. | xref:BloombergLP/bdlma/BufferedSequentialPool/allocate.adoc[`allocate`] | Return the address of a contiguous block of memory of the specified `size` (in bytes) according to the alignment strategy specified at construction. If `size` is 0, no memory is allocated and 0 is returned. If the allocation request exceeds the remaining free memory space in the external buffer supplied at construction, use memory obtained from the allocator supplied at construction. | xref:BloombergLP/bdlma/BufferedSequentialPool/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/BufferedSequentialPool/deleteObject.adoc[`deleteObject`] | Destroy the specified `object`. Note that this method has the same effect as the `deleteObjectRaw` method (since no deallocation is involved), and exists for consistency across memory pools. | xref:BloombergLP/bdlma/BufferedSequentialPool/deleteObjectRaw.adoc[`deleteObjectRaw`] | Destroy the specified `object`. Note that memory associated with `object` is not deallocated because there is no `deallocate` method in `BufferedSequentialPool`. | xref:BloombergLP/bdlma/BufferedSequentialPool/release.adoc[`release`] | Release all memory allocated through this pool and return to the underlying allocator _all_ memory except the external buffer supplied at construction. The pool is reset to its default‐constructed state, making the memory from the entire external buffer supplied at construction available for subsequent allocations, retaining the alignment and growth strategies, and the initial and maximum buffer sizes in effect following construction. The effect of subsequently ‐ to this invokation of `release` ‐ using a pointer obtained from this object prior to this call to `release` is undefined. | xref:BloombergLP/bdlma/BufferedSequentialPool/rewind.adoc[`rewind`] | Release all memory allocated through this pool and return to the underlying allocator _only_ memory that was allocated outside of the typical internal buffer growth of this pool (i.e., large blocks). All retained memory will be used to satisfy subsequent allocations. The effect of subsequently ‐ to this invokation of `rewind` ‐ using a pointer obtained from this object prior to this call to `rewind` is undefined. |=== == Data Members [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlma/BufferedSequentialPool/d_allocator_p.adoc[`d_allocator_p`] [.small]#[variant member]# | Allocator supplied at construction when the sequential pool has not yet been created. | xref:BloombergLP/bdlma/BufferedSequentialPool/d_pool_p.adoc[`d_pool_p`] [.small]#[variant member]# | Sequential pool used once the external buffer is exhausted. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#