50 return std::make_unique<BlobMemoryPool>(
allocator, _blobs);
58 void BlobLifetimeManager::update_blobs_and_mappings()
64 _free_blobs.sort([](
const Blob &ba,
const Blob &bb) {
return ba.max_size > bb.max_size; });
67 std::vector<BlobInfo> group_sizes;
68 std::transform(std::begin(_free_blobs),
std::end(_free_blobs), std::back_inserter(group_sizes),
70 return BlobInfo{
b.max_size,
b.max_alignment,
b.bound_elements.size()};
74 size_t max_size = std::max(_blobs.size(), group_sizes.size());
75 _blobs.resize(max_size);
76 group_sizes.resize(max_size);
77 std::transform(std::begin(_blobs),
std::end(_blobs), std::begin(group_sizes), std::begin(_blobs),
78 [](BlobInfo lhs, BlobInfo rhs)
80 return BlobInfo{std::max(lhs.size, rhs.size), std::max(lhs.alignment, rhs.alignment),
81 std::max(lhs.owners, rhs.owners)};
85 auto &group_mappings = _active_group->mappings();
87 for (
auto &free_blob : _free_blobs)
89 for (
auto &bound_element_id : free_blob.bound_elements)
92 Element &bound_element = _active_elements[bound_element_id];
93 group_mappings[bound_element.handle] = blob_idx;