|
UMPIRE
Umpire: resource management and provision
|
Provides a unified interface to allocate and free data. More...
#include </home/docs/checkouts/readthedocs.org/user_builds/umpire/checkouts/develop/src/umpire/Allocator.hpp>

Public Member Functions | |
| void * | allocate (std::size_t bytes) |
| Allocate bytes of memory. More... | |
| void * | allocate (std::size_t bytes, camp::resources::Resource const &r) |
| void * | allocate (const std::string &name, std::size_t bytes) |
| void | deallocate (void *ptr) |
| Free the memory at ptr. More... | |
| void | deallocate (void *ptr, camp::resources::Resource const &r) |
| void | release () |
| Release any and all unused memory held by this Allocator. More... | |
| std::size_t | getSize (void *ptr) const |
| Return number of bytes allocated for allocation. More... | |
| std::size_t | getHighWatermark () const noexcept |
| Return the memory high watermark for this Allocator. More... | |
| std::size_t | getCurrentSize () const noexcept |
| Return the current size of this Allocator. More... | |
| std::size_t | getActualSize () const noexcept |
| Return the actual size of this Allocator. More... | |
| std::size_t | getAllocationCount () const noexcept |
| Return the number of active allocations. More... | |
| const std::string & | getName () const noexcept |
| Get the name of this Allocator. More... | |
| int | getId () const noexcept |
| Get the integer ID of this Allocator. More... | |
| strategy::AllocationStrategy * | getParent () const noexcept |
| strategy::AllocationStrategy * | getAllocationStrategy () noexcept |
| Get the AllocationStrategy object used by this Allocator. More... | |
| Platform | getPlatform () noexcept |
| Get the Platform object appropriate for this Allocator. More... | |
| bool | isTracked () const noexcept |
| const std::string & | getStrategyName () const noexcept |
| Allocator ()=default | |
Friends | |
| class | ResourceManager |
| class | ::AllocatorTest |
| class | umpire::op::HostReallocateOperation |
| class | umpire::op::GenericReallocateOperation |
| std::ostream & | operator<< (std::ostream &, const Allocator &) |
Provides a unified interface to allocate and free data.
An Allocator encapsulates all the details of how and where allocations will be made, and can also be used to introspect the memory resource. Allocator objects do not return typed allocations, so the pointer returned from the allocate method must be cast to the relevant type.
|
default |
|
inline |
Allocate bytes of memory.
The memory will be allocated as determined by the AllocationStrategy used by this Allocator. Note that this method does not guarantee new memory pages being requested from the underlying memory system, as the associated AllocationStrategy could have already allocated sufficient memory, or re-use existing allocations that were not returned to the system.
| bytes | Number of bytes to allocate (>= 0) |
Referenced by umpire::malloc(), umpire::ResourceManager::move(), and umpire_allocator_allocate().
|
inline |
|
inline |
|
inline |
Free the memory at ptr.
This method will throw an umpire::runtime_error if ptr was not allocated using this Allocator. If the value of the pointer is set to nullptr, this behavior is allowed, but it will be ignored. If you need to deallocate memory allocated by an unknown object, use the ResourceManager::deallocate method.
| ptr | Pointer to free (If nullptr, it will be ignored.) |
Referenced by umpire::DeviceAllocator::destroy(), and umpire_allocator_deallocate().
|
inline |
| void umpire::Allocator::release | ( | ) |
Release any and all unused memory held by this Allocator.
References umpire::util::message::Debug, umpire::event::operation, umpire::event::record(), umpire::strategy::AllocationStrategy::release(), and UMPIRE_LOG.
Referenced by umpire_allocator_release().
| std::size_t umpire::Allocator::getSize | ( | void * | ptr | ) | const |
Return number of bytes allocated for allocation.
| ptr | Pointer to allocation in question |
References umpire::util::message::Debug, umpire::ResourceManager::getInstance(), umpire::ResourceManager::getSize(), and UMPIRE_LOG.
Referenced by umpire_allocator_get_size().
|
noexcept |
Return the memory high watermark for this Allocator.
This is the largest amount of memory allocated by this Allocator. Note that this may be larger than the largest value returned by getCurrentSize.
References umpire::strategy::AllocationStrategy::getHighWatermark().
Referenced by umpire_allocator_get_high_watermark().
|
noexcept |
Return the current size of this Allocator.
This is sum of the sizes of all the tracked allocations. Note that this doesn't ever have to be equal to getHighWatermark.
References umpire::strategy::AllocationStrategy::getCurrentSize().
Referenced by umpire_allocator_get_current_size().
|
noexcept |
Return the actual size of this Allocator.
For non-pool allocators, this will be the same as getCurrentSize().
For pools, this is the total amount of memory allocated for blocks managed by the pool.
References umpire::strategy::AllocationStrategy::getActualSize().
Referenced by umpire::get_total_bytes_allocated(), and umpire_allocator_get_actual_size().
|
noexcept |
Return the number of active allocations.
References umpire::strategy::AllocationStrategy::getAllocationCount().
Referenced by umpire_allocator_get_allocation_count().
|
noexcept |
Get the name of this Allocator.
Allocators are uniquely named, and the name of the Allocator can be used to retrieve the same Allocator from the ResourceManager at a later time.
References umpire::strategy::AllocationStrategy::getName().
Referenced by umpire::coalesce(), umpire::find_pointer_from_name(), umpire::get_num_pending(), umpire::get_resource(), umpire::ResourceManager::move(), umpire::ResourceManager::reallocate(), umpire::ResourceManager::removeAlias(), umpire::to_string(), umpire_allocator_get_name(), and umpire_allocator_get_name_bufferify().
|
noexcept |
Get the integer ID of this Allocator.
Allocators are uniquely identified, and the ID of the Allocator can be used to retrieve the same Allocator from the ResourceManager at a later time.
References umpire::strategy::AllocationStrategy::getId().
Referenced by umpire::ResourceManager::removeAlias(), and umpire_allocator_get_id().
|
noexcept |
|
noexcept |
Get the AllocationStrategy object used by this Allocator.
References umpire::util::message::Debug, and UMPIRE_LOG.
Referenced by umpire::ResourceManager::addAlias(), umpire::get_num_pending(), umpire::get_resource(), umpire::ResourceManager::getDefaultAllocator(), umpire::ResourceManager::getOperation(), umpire::is_accessible(), umpire::ResourceManager::move(), umpire::ResourceManager::reallocate(), umpire::try_coalesce(), umpire_resourcemanager_register_allocation(), and umpire::util::unwrap_allocator().
|
noexcept |
Get the Platform object appropriate for this Allocator.
References umpire::strategy::AllocationStrategy::getPlatform().
Referenced by umpire::strategy::AllocationAdvisor::AllocationAdvisor(), and umpire::strategy::NumaPolicy::NumaPolicy().
|
noexcept |
|
noexcept |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |