Class MixedPool

Inheritance Relationships

Base Type

Class Documentation

class umpire::strategy::MixedPool : public umpire::strategy::AllocationStrategy

A faster pool that pulls from a series of pools.

Pool implementation using a series of FixedPools for small sizes, and a DynamicPool for sizes larger than (1 << LastFixed) bytes.

Public Functions

MixedPool(const std::string &name, int id, Allocator allocator, std::size_t smallest_fixed_obj_size = (1 << 8), std::size_t largest_fixed_obj_size = (1 << 17), std::size_t max_initial_fixed_pool_size = 1024 * 1024 * 2, std::size_t fixed_size_multiplier = 16, const std::size_t dynamic_initial_alloc_size = (512 * 1024 * 1024), const std::size_t dynamic_min_alloc_size = (1 * 1024 * 1024), const std::size_t dynamic_align_bytes = 16, DynamicPoolMap::CoalesceHeuristic dynamic_coalesce_heuristic = heuristic_percent_releasable(100)) noexcept

Creates a MixedPool of one or more fixed pools and a dynamic pool for large allocations.

  • name: Name of the pool

  • id: Unique identifier for lookup later in ResourceManager

  • allocator: Underlying allocator

  • smallest_fixed_obj_size: Smallest fixed pool object size in bytes

  • largest_fixed_obj_size: Largest fixed pool object size in bytes

  • max_initial_fixed_pool_size: Largest initial size of any fixed pool

  • fixed_size_multiplier: Fixed pool object size increase factor

  • dynamic_initial_alloc_size: Size the dynamic pool initially allocates

  • dynamic_min_alloc_bytes: Minimum size of all future allocations in the dynamic pool

  • dynamic_align_bytes: Size with which to align allocations (for the dynamic pool)

  • coalesce_heuristic: Heuristic callback function (for the dynamic pool)

void *allocate(std::size_t bytes) override

Allocate bytes of memory.


Pointer to start of allocated bytes.

  • bytes: Number of bytes to allocate.

void deallocate(void *ptr) override

Free the memory at ptr.

  • ptr: Pointer to free.

void release() override

Release any and all unused memory held by this AllocationStrategy.

std::size_t getCurrentSize() const noexcept override

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 getActualSize() const noexcept override

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 getHighWatermark() const noexcept override

Get the high watermark of the total allocated size.

This is equivalent to the highest observed value of getCurrentSize.


High watermark allocation size.

Platform getPlatform() noexcept override

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.

MemoryResourceTraits getTraits() const noexcept override
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.

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.

Protected Attributes

std::string m_name
int m_id