BloombergLP::bslma::Allocator

Pure abstract protocol for clients and suppliers of raw memory.

Synopsis

Declared in <bslma_allocator.h>

class Allocator
    : public std::pmr::memory_resource

Description

This protocol class provides a pure abstract interface and contract for clients and suppliers of raw memory. If the requested memory cannot be returned, the contract requires that an std::bad_alloc exception be thrown. Note that memory is guaranteed to be sufficiently aligned for any object of the requested size on the current platform, which may be less than the maximal alignment guarantee afforded by global operator new.

Base Classes

NameDescription
std::pmr::memory_resource

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
~Allocator [destructor] [virtual]Destroy this allocator.
operator=
allocate Return a newly allocated block of memory of at least size bytes.
deallocate Return the memory block at address to this allocator.
deleteObject deleteObject overloads
deleteObjectRaw deleteObjectRaw overloads
is_equal

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.

Derived Classes

NameDescription
AlignedAllocator Protocol for clients and suppliers of raw aligned memory.
AligningAllocator Allocator wrapper that guarantees a specified minimum alignment.
BufferAllocator Concrete buffer allocator that allocates from a user-supplied fixed-size buffer.
ConcurrentAllocatorAdapter Thread-enabled adapter that synchronizes access to a decorated allocator.
ConcurrentPoolAllocator Thread-safe allocator that manages pooled memory blocks of uniform size.
CountingAllocator This class maintains a count of the total number of allocated bytes.
CountingAllocator Concrete allocator that counts bytes currently in use and ever allocated.
GuardingAllocator Concrete thread-safe guarding allocator that adjoins a protected guard page to each allocated block.
HeapBypassAllocator Memory allocator that obtains storage directly from virtual memory.
MallocFreeAllocator This class provides direct access to the system-supplied (native) global std::malloc and std::free.
ManagedAllocator Protocol for allocators that support releasing all allocated memory.
ManagedAllocator Protocol for allocators that support releasing all allocated memory.
NewDeleteAllocator Concrete allocator adapting global operator new and operator delete.
TestAllocator Concrete test allocator that tracks memory usage for testing.