[#BloombergLP-bdlma-BufferedSequentialAllocator] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlma.adoc[bdlma]::BufferedSequentialAllocator :relfileprefix: ../../ :mrdocs: Fast allocator that dispenses heterogeneous blocks from an external buffer. == Synopsis Declared in `<bdlma_bufferedsequentialallocator.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class BufferedSequentialAllocator : public xref:BloombergLP/bdlma/ManagedAllocator.adoc[ManagedAllocator] ---- == Description This class implements the `ManagedAllocator` protocol to provide a fast allocator that 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 also supplied at construction; if no allocator is supplied, the currently installed default allocator is 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 allocator attempt to deallocate the external buffer. == Base Classes [cols="1,4"] |=== | Name| Description | `xref:BloombergLP/bdlma/ManagedAllocator.adoc[ManagedAllocator]` | Protocol for allocators that support releasing all allocated memory. |=== == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslma/Allocator/size_type.adoc[`size_type`] | Alias for an unsigned integral type capable of representing the number of bytes in this platform's virtual address space. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlma/BufferedSequentialAllocator/2constructor-00.adoc[`BufferedSequentialAllocator`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bdlma/BufferedSequentialAllocator/2destructor.adoc[`~BufferedSequentialAllocator`] [.small]#[destructor]# [.small]#[virtual]# | Destroy this buffered sequential allocator. All memory allocated from this allocator is released. | xref:BloombergLP/bslma/Allocator/operator_assign.adoc[`operator=`] | | xref:BloombergLP/bdlma/BufferedSequentialAllocator/allocate-0f.adoc[`allocate`] | Return a block of memory of the specified `size` (in bytes). | xref:BloombergLP/bdlma/BufferedSequentialAllocator/allocator.adoc[`allocator`] | Return the allocator passed at construction. | xref:BloombergLP/bdlma/BufferedSequentialAllocator/deallocate-0c3.adoc[`deallocate`] | This method has no effect on the specified memory block. | xref:BloombergLP/bslma/Allocator/deleteObject-09.adoc[`deleteObject`] | `deleteObject` overloads | xref:BloombergLP/bslma/Allocator/deleteObjectRaw-06f.adoc[`deleteObjectRaw`] | `deleteObjectRaw` overloads | xref:BloombergLP/bslma/Allocator/is_equal.adoc[`is_equal`] | | xref:BloombergLP/bdlma/BufferedSequentialAllocator/release.adoc[`release`] [.small]#[virtual]# | Release all memory allocated through this allocator except the external buffer supplied at construction. | xref:BloombergLP/bdlma/BufferedSequentialAllocator/rewind.adoc[`rewind`] [.small]#[virtual]# | Release allocated memory while retaining this allocator's typical internal buffers. |=== == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslma/Allocator/throwBadAlloc.adoc[`throwBadAlloc`] | Throw `std::bad_alloc` or abort the program. |=== == Protected Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslma/Allocator/do_allocate.adoc[`do_allocate`] [.small]#[virtual]# | Return a newly allocated block of at least `bytes` with `alignment`. | xref:BloombergLP/bslma/Allocator/do_deallocate.adoc[`do_deallocate`] [.small]#[virtual]# | Return the memory block at `p` having `bytes` and `alignment`. | xref:BloombergLP/bslma/Allocator/do_is_equal.adoc[`do_is_equal`] [.small]#[virtual]# | Return whether this allocator can exchange memory with `other`. |=== == Derived Classes [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlma/LocalSequentialAllocator.adoc[`LocalSequentialAllocator`] | Fast allocator that dispenses heterogeneous blocks from a local buffer. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#