Concrete thread‐safe guarding allocator that adjoins a protected guard page to each allocated block.

Synopsis

Declared in <bdlma_guardingallocator.h>

class GuardingAllocator
    : public bslma::Allocator

Description

This class defines a concrete thread‐safe "guarding" allocator mechanism that implements the bslma::Allocator protocol, and adjoins a read/write protected guard page to each block of memory returned by the allocate method. The guard page is placed immediately before or immediately following the block returned from allocate according to the GuardPageLocation enumerator value (optionally) supplied at construction. Note that, unlike many other allocators, an allocator cannot be (optionally) supplied at construction; instead, a system facility is used that allocates blocks of memory in multiples of the system page size. Also note that this allocator is intended for debugging purposes only.

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.

Enums

Name

Description

GuardPageLocation

Enumerate the configuration options for GuardingAllocator that may be (optionally) supplied at construction.

Member Functions

Name

Description

GuardingAllocator [constructor]

Create a guarding allocator.

~GuardingAllocator [destructor] [virtual]

Destroy this allocator object. Note that destroying this allocator has no effect on any outstanding allocated memory.

operator=

allocate

allocate overloads

deallocate

Return the memory block at the specified address back to this 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