Class FixedPool

Nested Relationships

Inheritance Relationships

Base Type

Class Documentation

class FixedPool : public umpire::strategy::AllocationStrategy

Pool for fixed size allocations.

This AllocationStrategy provides an efficient pool for fixed size allocations, and used to quickly allocate and deallocate objects.

Public Functions

FixedPool(const std::string &name, int id, Allocator allocator, const std::size_t object_bytes, const std::size_t objects_per_pool = 64 * sizeof(int) * 8)

Constructs a FixedPool.

  • name: The allocator name for reference later in ResourceManager

  • id: The allocator id for reference later in ResourceManager

  • allocator: Used for data allocation. It uses std::malloc for internal tracking of these allocations.

  • object_bytes: The fixed size (in bytes) for each allocation

  • objects_per_pool: Number of objects in each sub-pool internally. Performance likely improves if this is large, at the cost of memory usage. This does not have to be a multiple of sizeof(int)*8, but it will also likely improve performance if so.

FixedPool(const FixedPool&)
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)

Free the memory at ptr.

  • ptr: Pointer to free.

std::size_t 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.


Current total size of allocations.

std::size_t getHighWatermark() const

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

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.

Platform getPlatform()

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.

bool pointerIsFromPool(void *ptr) const
std::size_t numPools() const
void release()

Release any and all unused memory held by this AllocationStrategy.

const std::string &getName()

Get the name of this AllocationStrategy.


The name of this AllocationStrategy.

int getId()

Get the id of this AllocationStrategy.


The id of this AllocationStrategy.

Protected Attributes

std::string m_name
int m_id