Memory allocator that obtains storage directly from virtual memory.

Synopsis

Declared in <bdlma_heapbypassallocator.h>

class HeapBypassAllocator
    : public bslma::Allocator

Description

This class allows the caller to allocate memory directly from virtual memory, without going through the heap like malloc or new would. Note that the only way to free any memory allocated with this object is to destroy the object, at which point all memory it has allocated is freed. Thread‐safe.

Base Classes

Name

Description

bslma::Allocator

Pure abstract protocol for clients and suppliers of raw memory.

Type Aliases

Name

Description

size_type

Alias for an unsigned integral type capable of representing the number of bytes in this platform's virtual address space.

Member Functions

Name

Description

HeapBypassAllocator [constructor]

Constructors

~HeapBypassAllocator [destructor] [virtual]

Destroy this object, releasing all managed buffers of memory that it has allocated.

operator=

allocate

allocate overloads

deallocate

This method has no effect for this heap bypass allocator.

deleteObject

deleteObject overloads

deleteObjectRaw

deleteObjectRaw overloads

is_equal

Static Member Functions

Name

Description

throwBadAlloc

Throw std::bad_alloc or abort the program.

Protected Member Functions

Name

Description

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.

Created with MrDocs