This class maintains a count of the total number of allocated bytes.
The running byte count is initialized to 0 upon construction, is increased by the allocate method, and may be reset to 0 by the resetNumBytesTotal method. The deallocate method appropriately decrement the byte count. The precise definition of byte count is described in the "Byte Count" section of the component-level documentation.
| Name | Description |
|---|---|
bslma::Allocator | Pure abstract protocol for clients and suppliers of raw memory. |
| Name | Description |
|---|---|
size_type | Alias for an unsigned integral type capable of representing the number of bytes in this platform's virtual address space. |
| Name | Description |
|---|---|
CountingAllocator [constructor] | Create a counting allocator having an initial byte count of 0. |
~CountingAllocator [destructor] [virtual] | Destroy this counting allocator. |
operator= | |
allocate | Allocate a maximally aligned block of the specified size. |
deallocate | Return the memory at the specified address to this allocator. |
deleteObject | deleteObject overloads |
deleteObjectRaw | deleteObjectRaw overloads |
is_equal | |
numBytesTotal | Return the byte count maintained by this counting allocator. |
resetNumBytesTotal | Reset the byte count maintained by this counting allocator to 0. |
| Name | Description |
|---|---|
throwBadAlloc | Throw std::bad_alloc or abort the program. |
| 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. |