23.11
|
Go to the documentation of this file.
24 #ifndef ARM_COMPUTE_MEMORYGROUP_H
25 #define ARM_COMPUTE_MEMORYGROUP_H
46 MemoryGroup(std::shared_ptr<IMemoryManager> =
nullptr) noexcept;
66 std::shared_ptr<IMemoryManager> _memory_manager;
72 : _memory_manager(memory_manager), _pool(
nullptr), _mappings()
78 if (_memory_manager && (obj !=
nullptr))
83 _memory_manager->lifetime_manager()->register_group(
this);
89 _memory_manager->lifetime_manager()->start_lifetime(obj);
98 _memory_manager->lifetime_manager()->end_lifetime(obj, obj_memory, size, alignment);
104 if (!_mappings.empty())
107 _pool = _memory_manager->pool_manager()->lock_pool();
114 if (_pool !=
nullptr)
119 _memory_manager->pool_manager()->unlock_pool(_pool);
virtual void associate_memory_group(IMemoryGroup *memory_group)=0
Associates a memory managable object with the memory group that manages it.
void manage(IMemoryManageable *obj) override
Sets a object to be managed by the given memory group.
Interface of an object than can be memory managed.
void finalize_memory(IMemoryManageable *obj, IMemory &obj_memory, size_t size, size_t alignment) override
Finalizes memory for a given object.
~MemoryGroup()=default
Default destructor.
void acquire() override
Acquires backing memory for the whole group.
MemoryGroup(std::shared_ptr< IMemoryManager >=nullptr) noexcept
Default Constructor.
void release() override
Releases backing memory of the whole group.
MemoryMappings & mappings() override
Gets the memory mapping of the group.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
MemoryGroup & operator=(const MemoryGroup &)=delete
Prevent instances of this class from being copy assigned (As this class contains pointers)
virtual void release(MemoryMappings &handles)=0
Releases a memory block.
virtual void acquire(MemoryMappings &handles)=0
Sets occupant to the memory pool.
Copyright (c) 2017-2023 Arm Limited.
std::map< IMemory *, size_t > MemoryMappings
A map of (handle, index/offset), where handle is the memory handle of the object to provide the memor...