36 : _allocator(allocator), _blobs(), _blob_info(
std::move(blob_info))
39 allocate_blobs(_blob_info);
51 for(
auto &handle : handles)
54 handle.first->set_region(_blobs[handle.second].get());
60 for(
auto &handle : handles)
63 handle.first->set_region(
nullptr);
75 return std::make_unique<BlobMemoryPool>(_allocator, _blob_info);
78 void BlobMemoryPool::allocate_blobs(
const std::vector<BlobInfo> &blob_info)
82 for(
const auto &bi : blob_info)
84 _blobs.push_back(_allocator->
make_region(bi.size, bi.alignment));
88 void BlobMemoryPool::free_blobs()
MappingType mapping_type() const override
Returns the mapping types that this pool accepts.
~BlobMemoryPool()
Default Destructor.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Copyright (c) 2017-2021 Arm Limited.
Mappings are in blob granularity.
void acquire(MemoryMappings &handles) override
Sets occupant to the memory pool.
std::unique_ptr< IMemoryPool > duplicate() override
Duplicates the existing memory pool.
input allocator() -> allocate()
virtual std::unique_ptr< IMemoryRegion > make_region(size_t size, size_t alignment)=0
Create self-managed memory region.
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...
BlobMemoryPool(IAllocator *allocator, std::vector< BlobInfo > blob_info)
Default Constructor.
void release(MemoryMappings &handles) override
Releases a memory block.