Class DynamicPoolList¶
Defined in File DynamicPoolList.hpp
Inheritance Relationships¶
Base Type¶
public umpire::strategy::AllocationStrategy
(Class AllocationStrategy)
Class Documentation¶
-
class
umpire::strategy
::
DynamicPoolList
: 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.
Public Types
-
using
CoalesceHeuristic
= std::function<bool(const strategy::DynamicPoolList&)>¶
Public Functions
-
DynamicPoolList
(const std::string &name, int id, Allocator allocator, const std::size_t first_minimum_pool_allocation_size = (512 * 1024 * 1024), const std::size_t next_minimum_pool_allocation_size = (1 * 1024 * 1024), const std::size_t alignment = 16, CoalesceHeuristic should_coalesce = percent_releasable(100)) noexcept¶ Construct a new DynamicPoolList.
- Parameters
name
: Name of this instance of the DynamicPoolList.id
: Id of this instance of the DynamicPoolList.allocator
: Allocation resource that pool usesfirst_minimum_pool_allocation_size
: Minimum size the pool initially allocatesnext_minimum_pool_allocation_size
: The minimum size of all future allocations.align_bytes
: Number of bytes with which to align allocation sizes (power-of-2)do_heuristic
: Heuristic for when to perform coalesce operation
-
DynamicPoolList
(const DynamicPoolList&) = delete¶
-
void *
allocate
(size_t bytes) override¶
-
void
deallocate
(void *ptr) override¶ Free the memory at ptr.
- Parameters
ptr
: Pointer to free.
-
void
release
() override¶ Release any and all unused memory held by this AllocationStrategy.
-
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.
- Return
The total size of all the memory this object has allocated.
-
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.
- Return
Current total size of allocations.
-
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.
- Return
The platform associated with this AllocationStrategy.
-
MemoryResourceTraits
getTraits
() const noexcept final override¶
-
std::size_t
getReleasableSize
() const noexcept¶ Get the number of bytes that may be released back to resource.
A memory pool has a set of blocks that have no allocations against them. If the size of the set is greater than one, then the pool will have a number of bytes that may be released back to the resource or coalesced into a larger block.
- Return
The total number of bytes that are releasable
-
std::size_t
getBlocksInPool
() const noexcept¶ Get the number of memory blocks that the pool has.
- Return
The total number of blocks that are allocated by the pool
-
std::size_t
getLargestAvailableBlock
() const noexcept¶ Get the largest allocatable number of bytes from pool before the pool will grow.
return The largest number of bytes that may be allocated without causing pool growth
-
void
coalesce
() noexcept¶
-
void *
allocate
(std::size_t bytes) = 0¶ Allocate bytes of memory.
- Return
Pointer to start of allocated bytes.
- Parameters
bytes
: Number of bytes to allocate.
-
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.
- Return
High watermark allocation size.
-
std::size_t
getAllocationCount
() const noexcept¶ Get the total number of active allocations by this allocator.
- Return
The total number of active allocations this object has allocated.
-
const std::string &
getName
() noexcept¶ Get the name of this AllocationStrategy.
- Return
The name of this AllocationStrategy.
-
int
getId
() noexcept¶ Get the id of this AllocationStrategy.
- Return
The id of this AllocationStrategy.
Public Static Functions
-
CoalesceHeuristic
percent_releasable
(int percentage)¶
-
using