BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdlma::BlockList Class Reference

#include <bdlma_blocklist.h>

Public Member Functions

 BlockList (bslma::Allocator *basicAllocator=0)
 
 ~BlockList ()
 
void * allocate (bsls::Types::size_type size)
 
void deallocate (void *address)
 
void release ()
 
bslma::Allocatorallocator () const
 Return the allocator used by this object to allocate memory.
 

Detailed Description

This class implements a low-level memory manager that allocates and manages a sequence of memory blocks – each potentially of a different size as specified during the invocation of the allocate method. Allocated blocks may be efficiently deallocated individually, i.e., potentially in constant time depending on the supplied allocator. The release method deallocates the entire sequence of memory blocks, as does the destructor.

See bdlma_blocklist

Constructor & Destructor Documentation

◆ BlockList()

bdlma::BlockList::BlockList ( bslma::Allocator basicAllocator = 0)
inlineexplicit

Create an empty block list suitable for managing memory blocks of varying sizes. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used.

◆ ~BlockList()

bdlma::BlockList::~BlockList ( )

Destroy this object and deallocate all outstanding memory blocks managed by this object.

Member Function Documentation

◆ allocate()

void * bdlma::BlockList::allocate ( bsls::Types::size_type  size)

Return the address of a contiguous block of memory of the specified size (in bytes). If size is 0, no memory is allocated and 0 is returned. The returned memory is guaranteed to be maximally aligned.

◆ allocator()

bslma::Allocator * bdlma::BlockList::allocator ( ) const
inline

◆ deallocate()

void bdlma::BlockList::deallocate ( void *  address)

Return the memory at the specified address back to the associated allocator. If address is 0, this function has no effect. The behavior is undefined unless address was allocated by this object, and has not already been deallocated.

◆ release()

void bdlma::BlockList::release ( )

Deallocate all memory blocks currently managed by this object, returning it to its default-constructed state.


The documentation for this class was generated from the following file: