Strategies

Strategies are used in Umpire to allow custom algorithms to be applied when allocating memory. These strategies can do anything, from providing different pooling methods to speed up allocations to applying different operations to every alloctaion. Strategies can be composed to combine their functionality, allowing flexible and reusable implementations of different components.

class AllocationStrategy : public std::enable_shared_from_this<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::AllocationAdvisor, umpire::strategy::AllocationTracker, umpire::strategy::DefaultAllocationStrategy, umpire::strategy::DynamicPool, umpire::strategy::FixedPool< T, NP, IA >, umpire::strategy::MonotonicAllocationStrategy, umpire::strategy::SizeLimiter, umpire::strategy::SlotPool, umpire::strategy::ThreadSafeAllocator

Provided Strategies

class AllocationAdvisor : public umpire::strategy::AllocationStrategy

Applies the given MemoryOperation to every allocation.

This AllocationStrategy is designed to be used with the following operations:

Using this AllocationStrategy when combined with a pool like DynamicPool is a good way to mitigate the overhead of applying the memory advice.

class DynamicPool : public umpire::strategy::AllocationStrategy

Simple dynamic pool for allocations.

This AllocationStrategy uses Simpool to provide pooling for allocations of any size. The behavior of the pool can be controlled by two parameters: the initial allocation size, and the minimum allocation size.

The initial size controls how large the first piece of memory allocated is, and the minimum size controls the lower bound on all future chunk allocations.

template <typename T, int NP = 64, typename IA = StdAllocator>
class FixedPool : public umpire::strategy::AllocationStrategy

Pool for fixed size allocations.

This AllocationStrategy provides an efficient pool for fixed size allocations of size T. Pools of NP objects of type T are constructed, and used to quickly allocate and deallocate objects.

class MonotonicAllocationStrategy : public umpire::strategy::AllocationStrategy
class SlotPool : public umpire::strategy::AllocationStrategy