Template Class DefaultMemoryResource¶
- Defined in File DefaultMemoryResource.hpp
Inheritance Relationships¶
Base Types¶
public umpire::resource::MemoryResource
(Class MemoryResource)private umpire::strategy::mixins::Inspector
(Class Inspector)
Class Documentation¶
-
template <typename _allocator>
classDefaultMemoryResource
: public umpire::resource::MemoryResource, umpire::strategy::mixins::Inspector¶ Concrete MemoryResource object that uses the template _allocator to allocate and deallocate memory.
Public Functions
-
void *
allocate
(size_t bytes)¶ Allocate bytes of memory.
This function is pure virtual and must be implemented by the inheriting class.
- Return
- Pointer to start of allocation.
- Parameters
bytes
: Number of bytes to allocate.
-
void
deallocate
(void *ptr)¶ Free the memory at ptr.
This function is pure virtual and must be implemented by the inheriting class.
- Parameters
ptr
: Pointer to free.
-
long
getCurrentSize
()¶ Return the current size of this MemoryResource.
This is sum of the sizes of all the tracked allocations. Note that this doesn’t ever have to be equal to getHighWatermark.
- Return
- current total size of active allocations in this MemoryResource.
-
long
getHighWatermark
()¶ Return the memory high watermark for this MemoryResource.
This is the largest amount of memory allocated by this Allocator. Note that this may be larger than the largest value returned by getCurrentSize.
- Return
- Memory high watermark.
-
Platform
getPlatform
()¶ Get the Platform assocatiated with this MemoryResource.
This function is pure virtual and must be implemented by the inheriting class.
- Return
- Platform associated with this MemoryResource.
-
long
getActualSize
() 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::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.
-
void *