Class AllocationStrategy

Inheritance Relationships

Derived Types

Class Documentation

class umpire::strategy::AllocationStrategy

AllocationStrategy provides a unified interface to all classes that can be used to allocate and free data.

Subclassed by umpire::resource::MemoryResource, umpire::strategy::AlignedAllocator, umpire::strategy::AllocationAdvisor, umpire::strategy::AllocationPrefetcher, umpire::strategy::AllocationTracker, umpire::strategy::DynamicPoolList, umpire::strategy::DynamicPoolMap, umpire::strategy::FixedPool, umpire::strategy::MixedPool, umpire::strategy::MonotonicAllocationStrategy, umpire::strategy::NamedAllocationStrategy, umpire::strategy::NumaPolicy, umpire::strategy::QuickPool, umpire::strategy::SizeLimiter, umpire::strategy::SlotPool, umpire::strategy::ThreadSafeAllocator, umpire::strategy::ZeroByteHandler

Public Functions

AllocationStrategy(const std::string &name, int id) noexcept

Construct a new AllocationStrategy object.

All AllocationStrategy objects must will have a unique name and id. This uniqueness is enforced by the ResourceManager.


~AllocationStrategy() = default
void *allocate(std::size_t bytes) = 0

Allocate bytes of memory.


Pointer to start of allocated bytes.

  • bytes: Number of bytes to allocate.

void deallocate(void *ptr) = 0

Free the memory at ptr.

  • ptr: Pointer to free.

void release()

Release any and all unused memory held by this AllocationStrategy.

std::size_t getCurrentSize() const noexcept

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.


Current total size of allocations.

std::size_t getHighWatermark() const noexcept

Get the high watermark of the total allocated size.

This is equivalent to the highest observed value of getCurrentSize.


High watermark allocation size.

std::size_t getActualSize() const noexcept

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.


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

std::size_t getAllocationCount() const noexcept

Get the total number of active allocations by this allocator.


The total number of active allocations this object has allocated.

Platform getPlatform() noexcept = 0

Get the platform associated with this AllocationStrategy.

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


The platform associated with this AllocationStrategy.

const std::string &getName() noexcept

Get the name of this AllocationStrategy.


The name of this AllocationStrategy.

int getId() noexcept

Get the id of this AllocationStrategy.


The id of this AllocationStrategy.

MemoryResourceTraits getTraits() const noexcept

Protected Attributes

std::string m_name
int m_id


friend std::ostream &operator<<(std::ostream &os, const AllocationStrategy &strategy)