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

Fast allocator that dispenses heterogeneous blocks from dynamically allocated buffers&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class SequentialAllocator
    : 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&hyphen;specified sizes) from a sequence of dynamically&hyphen;allocated buffers&period; Memory for the internal buffers is supplied by an (optional) allocator supplied at construction&semi; if no allocator is supplied, the currently installed default allocator is used&period; If an allocation exceeds the remaining free memory space in the current buffer, the allocator replenishes its internal buffer with new memory to satisfy the request&period; This class is _exception_ _neutral_&colon; If memory cannot be allocated, the behavior is defined by the (optional) allocator specified at construction&period;

== Base Classes

[cols="1,4"]
|===
| Name| Description
| `xref:BloombergLP/bdlma/ManagedAllocator.adoc[ManagedAllocator]`
| Protocol for allocators that support releasing all allocated memory&period;
|===

== Type Aliases

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslma/Allocator/size_type.adoc[`size&lowbar;type`] 
| Alias for an unsigned integral type capable of representing the number of bytes in this platform&apos;s virtual address space&period;
|===


== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bdlma/SequentialAllocator/2constructor-0df.adoc[`SequentialAllocator`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/bdlma/SequentialAllocator/2destructor.adoc[`&#126;SequentialAllocator`] [.small]#[destructor]# [.small]#[virtual]#
| Destroy this sequential allocator&period; All memory allocated from this allocator is released&period;
| xref:BloombergLP/bslma/Allocator/operator_assign.adoc[`operator&equals;`] 
| 
| xref:BloombergLP/bdlma/SequentialAllocator/allocate-04.adoc[`allocate`] 
| `allocate` overloads
| xref:BloombergLP/bdlma/SequentialAllocator/allocateAndExpand.adoc[`allocateAndExpand`] 
| Return a block of at least `&ast;size` bytes and load the actual size into `&ast;size`&period;
| xref:BloombergLP/bdlma/SequentialAllocator/deallocate-034.adoc[`deallocate`] 
| This method has no effect&semi; memory is managed by this allocator&period;
| 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&lowbar;equal`] 
| 
| xref:BloombergLP/bdlma/SequentialAllocator/release.adoc[`release`]  [.small]#[virtual]#
| Release all memory allocated through this allocator&period;
| xref:BloombergLP/bdlma/SequentialAllocator/reserveCapacity.adoc[`reserveCapacity`] 
| Reserve enough memory to satisfy at least `numBytes` of allocations without replenishment&period;
| xref:BloombergLP/bdlma/SequentialAllocator/rewind.adoc[`rewind`]  [.small]#[virtual]#
| Release allocated memory while retaining this allocator&apos;s typical internal buffers&period;
| xref:BloombergLP/bdlma/SequentialAllocator/truncate.adoc[`truncate`] 
| Reduce the most recently allocated block at `address` from `originalSize` to `newSize`&period;
|===


== Static Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslma/Allocator/throwBadAlloc.adoc[`throwBadAlloc`] 
| Throw `std&colon;&colon;bad&lowbar;alloc` or abort the program&period;
|===


== Protected Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/bslma/Allocator/do_allocate.adoc[`do&lowbar;allocate`]  [.small]#[virtual]#
| Return a newly allocated block of at least `bytes` with `alignment`&period;
| xref:BloombergLP/bslma/Allocator/do_deallocate.adoc[`do&lowbar;deallocate`]  [.small]#[virtual]#
| Return the memory block at `p` having `bytes` and `alignment`&period;
| xref:BloombergLP/bslma/Allocator/do_is_equal.adoc[`do&lowbar;is&lowbar;equal`]  [.small]#[virtual]#
| Return whether this allocator can exchange memory with `other`&period;
|===



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