Class AllocationTracker

Inheritance Relationships

Base Types

Class Documentation

class AllocationTracker : public umpire::strategy::AllocationStrategy, umpire::strategy::mixins::Inspector

Public Functions

AllocationTracker(const std::string &name, int id, Allocator allocator)
void *allocate(size_t bytes)

Allocate bytes of memory.

Return
Pointer to start of allocated bytes.
Parameters
  • bytes: Number of bytes to allocate.

void deallocate(void *ptr)

Free the memory at ptr.

Parameters
  • ptr: Pointer to free.

void release()

Release any and all unused memory held by this AllocationStrategy.

long getCurrentSize() const

Get current (total) size of the allocated memory.

This is the total size of all allocation currently ‘live’ that have been made by this AllocationStrategy object.

Return
Current total size of allocations.

long getHighWatermark() const

Get the high watermark of the total allocated size.

This is equivalent to the highest observed value of getCurrentSize.

Return
High watermark allocation size.

long getActualSize() const

Get the current amount of memory allocated by this allocator.

Note that this can be larger than getCurrentSize(), particularly if the AllocationStrategy implements some kind of pooling.

Return
The total size of all the memory this object has allocated.

Platform getPlatform()

Get the platform associated with this AllocationStrategy.

The Platform distinguishes the appropriate place to execute operations on memory allocated by this AllocationStrategy.

Return
The platform associated with this AllocationStrategy.

std::shared_ptr<umpire::strategy::AllocationStrategy> getAllocationStrategy()
std::string getName()

Get the name of this AllocationStrategy.

Return
The name of this AllocationStrategy.

int getId()

Get the id of this AllocationStrategy.

Return
The id of this AllocationStrategy.

Protected Attributes

std::string m_name
int m_id

Private Functions

void registerAllocation(void *ptr, size_t size, std::shared_ptr<umpire::strategy::AllocationStrategy> strategy)
void deregisterAllocation(void *ptr)

Private Members

long m_current_size
long m_high_watermark