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.
Synopsis
Declared in <ball_countingallocator.h>
class CountingAllocator
: public bslma::Allocator
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 |
|
Create a counting allocator having an initial byte count of 0. Optionally specify a |
|
Destroy this counting allocator. |
Allocate a maximally aligned block of the specified |
|
Return the memory at the specified |
|
|
|
|
|
Return the byte count maintained by this counting allocator. The precise definition of byte count is described in the "Byte Count" section of the component‐level documentation. |
|
Reset the byte count maintained by this counting allocator to 0. |
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