BloombergLP::bdlma::BufferedSequentialAllocator

Fast allocator that dispenses heterogeneous blocks from an external buffer.

Synopsis

Declared in <bdlma_bufferedsequentialallocator.h>

class BufferedSequentialAllocator
    : public 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

NameDescription
ManagedAllocatorProtocol for allocators that support releasing all allocated memory.

Type Aliases

NameDescription
size_type Alias for an unsigned integral type capable of representing the number of bytes in this platform's virtual address space.

Member Functions

NameDescription
BufferedSequentialAllocator [constructor]Constructors
~BufferedSequentialAllocator [destructor] [virtual]Destroy this buffered sequential allocator. All memory allocated from this allocator is released.
operator=
allocate Return a block of memory of the specified size (in bytes).
allocator Return the allocator passed at construction.
deallocate This method has no effect on the specified memory block.
deleteObject deleteObject overloads
deleteObjectRaw deleteObjectRaw overloads
is_equal
release [virtual]Release all memory allocated through this allocator except the external buffer supplied at construction.
rewind [virtual]Release allocated memory while retaining this allocator's typical internal buffers.

Static Member Functions

NameDescription
throwBadAlloc Throw std::bad_alloc or abort the program.

Protected Member Functions

NameDescription
do_allocate [virtual]Return a newly allocated block of at least bytes with alignment.
do_deallocate [virtual]Return the memory block at p having bytes and alignment.
do_is_equal [virtual]Return whether this allocator can exchange memory with other.

Derived Classes

NameDescription
LocalSequentialAllocator Fast allocator that dispenses heterogeneous blocks from a local buffer.