Class AllocationStrategy¶
- Defined in File AllocationStrategy.hpp
Inheritance Relationships¶
Base Type¶
public std::enable_shared_from_this< AllocationStrategy >
Derived Types¶
public umpire::resource::MemoryResource
(Class MemoryResource)public umpire::strategy::AllocationAdvisor
(Class AllocationAdvisor)public umpire::strategy::AllocationTracker
(Class AllocationTracker)public umpire::strategy::DefaultAllocationStrategy
(Class DefaultAllocationStrategy)public umpire::strategy::DynamicPool
(Class DynamicPool)public umpire::strategy::FixedPool< T, NP, IA >
(Template Class FixedPool)public umpire::strategy::MonotonicAllocationStrategy
(Class MonotonicAllocationStrategy)public umpire::strategy::SizeLimiter
(Class SizeLimiter)public umpire::strategy::SlotPool
(Class SlotPool)public umpire::strategy::ThreadSafeAllocator
(Class ThreadSafeAllocator)
Class Documentation¶
-
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
Public Functions
-
AllocationStrategy
(const std::string &name, int id)¶ Construct a new AllocationStrategy object.
All AllocationStrategy objects must will have a unique name and id. This uniqueness is enforced by the ResourceManager.
- Parameters
name
: The name of this AllocationStrategy object.id
: The id of this AllocationStrategy object.
-
virtual
~AllocationStrategy
()¶
-
virtual void *
allocate
(size_t bytes) = 0¶ Allocate bytes of memory.
- Return
- Pointer to start of allocated bytes.
- Parameters
bytes
: Number of bytes to allocate.
-
virtual void
deallocate
(void *ptr) = 0¶ Free the memory at ptr.
- Parameters
ptr
: Pointer to free.
-
void
release
() Release any and all unused memory held by this AllocationStrategy.
-
virtual long
getCurrentSize
() const = 0¶ 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.
-
virtual long
getHighWatermark
() const = 0¶ Get the high watermark of the total allocated size.
This is equivalent to the highest observed value of getCurrentSize.
- Return
- High watermark allocation size.
-
long
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.
- Return
- The total size of all the memory this object has allocated.
-
virtual Platform
getPlatform
() = 0¶ 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.
-
std::string
getName
() Get the name of this AllocationStrategy.
- Return
- The name of this AllocationStrategy.
-
int
getId
() Get the id of this AllocationStrategy.
- Return
- The id of this AllocationStrategy.
Protected Attributes
-
std::string
m_name
-
int
m_id
-