BloombergLP::bslma::SequentialPool

This class implements a memory pool that dispenses arbitrarily-sized blocks of memory.

Synopsis

Declared in <bslma_sequentialpool.h>

class SequentialPool;

Description

This class implements a memory pool that dispenses arbitrarily-sized blocks of memory from an internal buffer or an optionally user-supplied buffer. If an allocation request exceeds the remaining free memory space in the current buffer, the pool either replenishes its buffer with new memory to satisfy the request, or returns a separate memory block, depending on whether the request size exceeds an optionally specified maximum buffer size. By default, buffer growth is not capped. The release method releases all memory allocated through this pool, as does the destructor. Note, however, that individual allocated blocks of memory cannot be individually deallocated.

Member Functions

NameDescription
SequentialPool [constructor]Constructors
~SequentialPool [destructor]Destroy this object and release all memory currently allocated through this pool.
allocate Return memory of the specified size. If size is 0, no memory is allocated and 0 is returned. The behavior is undefined unless 0 <= size.
allocateAndExpand allocateAndExpand overloads
deleteObject Destroy the specified object.
deleteObjectRaw Destroy *object without deallocating its footprint.
expand expand overloads
release Release all memory currently allocated through this pool.
reserveCapacity Reserve sufficient memory for at least the specified numBytes.
truncate Reduce the amount of memory allocated at the specified address.