This class defines a concrete "counting" allocator mechanism that implements the bslma::Allocator protocol, and provides instrumentation to track: (1) the number of bytes currently in use, and (2) the cumulative number of bytes that have ever been allocated. The accumulated statistics are based solely on the number of bytes requested (see allocate).
Synopsis
Declared in <bdlma_countingallocator.h>
class CountingAllocator
: public bslma::Allocator
Description
Note that, like many other allocators, this allocator relies on the currently installed default allocator (see bslma_default). Clients may, however, override this allocator by supplying (at construction) any other allocator implementing the bslma::Allocator protocol provided that it is fully thread‐safe.
Base Classes
Name |
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 |
Type Aliases
Name |
Description |
Alias for an unsigned integral type capable of representing the number of bytes in this platform's virtual address space. |
Member Functions
Name |
Description |
|
Constructors |
|
Destroy this allocator object. Note that destroying this allocator has no effect on any outstanding allocated memory. |
|
|
Return the memory block at the specified |
|
|
|
|
|
Return the name of this counting allocator, or 0 if no name was specified at construction. |
|
Return the number of bytes currently allocated from this object. Note that |
|
Return the cumulative number of bytes ever allocated from this object. Note that |
|
Write the accumulated state information held in this allocator to the specified |
Static Member Functions
Name |
Description |
Throw |
Protected Member Functions
Name |
Description |
|
Return a newly allocated block of memory of (at least) the specified positive |
|
Return the memory block at the specified |
|
Return |
Created with MrDocs