Create a sequential allocator using the specified external buffer with a maximum buffer size.
Synopsis
Declared in <bslma_sequentialallocator.h>
SequentialAllocator(
char* buffer,
int bufferSize,
int maxBufferSize,
Allocator* basicAllocator = 0);
Description
Create a sequential allocator for allocating memory blocks initially from the specified buffer the size (in bytes) of which is indicated by the absolute value of the specified bufferSize. The specified maxBufferSize indicates the maximum size (in bytes) allowed for internally allocated buffers. Optionally specify an alignment strategy used to align allocated memory blocks. If strategy is not specified, Natural Alignment is used. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used. If an allocate or reserveCapacity request cannot be satisfied from the current buffer, a new buffer is allocated, the size of which is determined by a buffer growth strategy implied by bufferSize. If bufferSize is negative, the buffer growth strategy used is Geometric Growth; otherwise it is *Constant Growth*. (See the component level documentation for further details.) In either case, the new buffer will have sufficient capacity to satisfy the request. If Geometric Growth is in effect, the geometric progression of buffer sizes is capped at maxBufferSize. The behavior is undefined unless 0 < maxBufferSize, and |bufferSize| <= maxBufferSize. Note that maxBufferSize is ignored if bufferSize > 0. Also note that maxBufferSize may be overridden by a sufficiently large value passed to allocate or reserveCapacity.
Parameters
Name |
Description |
buffer |
The external buffer used for initial allocations. |
bufferSize |
The size (in bytes) of |
maxBufferSize |
The maximum internal buffer size (in bytes). |
basicAllocator |
The allocator used to supply memory. |
Created with MrDocs