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.
Declared in <bslma_sequentialpool.h>
class SequentialPool;
| Name | Description |
|---|---|
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. Note that this method is exactly the same as the deleteObjectRaw method since no deallocation is involved. This method exists purely for consistency across pools. |
deleteObjectRaw | Destroy the specified object. Note that the memory is not deallocated because there is no deallocate method in a bslma_sequentialpool. |
expand | expand overloads |
release | Release all memory currently allocated through this pool. |
reserveCapacity | Reserve sufficient memory to satisfy allocation requests for at least the specified numBytes without replenishment (i.e., without internal allocation). The behavior is undefined unless 0 <= numBytes. |
truncate | Reduce the amount of memory allocated at the specified address from the specified originalNumBytes to the specified newNumBytes. Return the amount of memory available at address after the truncation. The behavior is undefined unless the call to this allocator that provided the address was performed with the originalNumBytes and newNumBytes <= originalNumBytes. Note that this function will not truncate the memory unless there have been no allocations since the allocation for originalNumBytes. |