BloombergLP::bdlma::LocalSequentialAllocator

Fast allocator that dispenses heterogeneous blocks from a local buffer.

Synopsis

Declared in <bdlma_localsequentialallocator.h>

template<int t_SIZE>
class LocalSequentialAllocator
    : public BufferedSequentialAllocator

Description

This class implements the ManagedAllocator protocol to provide a fast allocator that dispenses heterogeneous blocks of memory (of varying, user-specified sizes) from a local buffer whose capacity is the specified t_SIZE (in bytes). If an allocation request exceeds the remaining free memory space in the local buffer, memory will be supplied by an (optional) allocator 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.

Base Classes

NameDescription
BufferedSequentialAllocatorFast allocator that dispenses heterogeneous blocks from an external buffer.

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
LocalSequentialAllocator [constructor]Create a local sequential allocator using an internal buffer of t_SIZE bytes.
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.