Fast memory pool dispensing blocks from an external buffer.

Synopsis

Declared in <bdlma_bufferedsequentialpool.h>

class BufferedSequentialPool;

Description

This class implements a fast memory pool that efficiently 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 supplied also at construction; if no allocator is supplied, the currently installed default allocator will be 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 pool attempt to deallocate the external buffer.

Member Functions

Name

Description

BufferedSequentialPool [constructor]

Constructors

~BufferedSequentialPool [destructor]

Destroy this buffered sequential pool. All memory allocated from this pool is released.

allocate

Return a block of memory of the specified size (in bytes).

allocator

Return the allocator used by this object to allocate memory. Note that this allocator can not be used to deallocate memory allocated through this pool.

deleteObject

Destroy the specified object.

deleteObjectRaw

Destroy the specified object.

release

Release all memory allocated through this pool except the external buffer supplied at construction.

rewind

Release allocated memory while retaining this pool's typical internal buffers.

Data Members

Name

Description

d_allocator_p [variant member]

Allocator supplied at construction when the sequential pool has not yet been created.

d_pool_p [variant member]

Sequential pool used once the external buffer is exhausted.

Created with MrDocs