Abstraction used to manage an user type with a memory manager.
More...
#include "managed_memory.h"
Abstraction used to manage an user type with a memory manager.
Definition at line 34 of file managed_memory.h.
◆ ManagedMemory()
hh::ManagedMemory::ManagedMemory |
( |
| ) |
|
|
default |
◆ ~ManagedMemory()
virtual hh::ManagedMemory::~ManagedMemory |
( |
| ) |
|
|
virtualdefault |
◆ canBeRecycled()
virtual bool hh::ManagedMemory::canBeRecycled |
( |
| ) |
|
|
inlinevirtual |
Accessor to test if the data can be cleaned and sent back to the Pool, true by default.
- Returns
- True if the data can be sent to the Pool, else False
Definition at line 71 of file managed_memory.h.
◆ clean()
virtual void hh::ManagedMemory::clean |
( |
| ) |
|
|
inlinevirtual |
Mechanism to clean data.
If the ManagedMemory type uses user-defined allocations, then clean is an appropriate place to deallocate the user-allocated data. It will be called only once before it is sent back to the pool.
- Attention
- If a StaticMemoryManager is used, then deallocation should be done within the destructor to match any allocations done within the constructor. (see StaticMemoryManager for more details)
Definition at line 78 of file managed_memory.h.
◆ isMemoryManagerConnected()
bool hh::ManagedMemory::isMemoryManagerConnected |
( |
| ) |
|
|
inline |
Test is a memory manager has been connected to the managed memory.
- Returns
- True if a memory manager has been connected, else False
Definition at line 46 of file managed_memory.h.
◆ memoryManager() [1/2]
Memory manager accessor.
- Returns
- Memory manager
Definition at line 50 of file managed_memory.h.
◆ memoryManager() [2/2]
Memory manager setter.
- Parameters
-
memoryManager | Memory manager to set |
Definition at line 54 of file managed_memory.h.
◆ postProcess()
virtual void hh::ManagedMemory::postProcess |
( |
| ) |
|
|
inlinevirtual |
Mechanism called by Hedgehog when the node returns the memory before it is tested for being recycled (call to canBeRecycled)
Definition at line 67 of file managed_memory.h.
◆ preProcess()
virtual void hh::ManagedMemory::preProcess |
( |
| ) |
|
|
inlinevirtual |
Mechanism to pre process the data.
If the ManagedMemory type uses user-defined allocations such as unified memory, then preProcess is an appropriate place to apply synchronization on any asynchronous operations that were applied in the clean function. It will be called only once before it is returned from getManagedMemory.
Definition at line 84 of file managed_memory.h.
◆ returnToMemoryManager()
void hh::ManagedMemory::returnToMemoryManager |
( |
| ) |
|
|
inline |
Return the data to the memory manager.
- Exceptions
-
std::runtime_error | if the data is not linked to a memory manager |
Definition at line 58 of file managed_memory.h.
◆ memoryManager_