| 890 | } |
| 891 | |
| 892 | void TxGraphImpl::CreateChunkData(GraphIndex idx, LinearizationIndex chunk_count) noexcept |
| 893 | { |
| 894 | auto& entry = m_entries[idx]; |
| 895 | // Make sure to not create chunk data for unlinked entries, which would make invoking |
| 896 | // m_fallback_order on them impossible. |
| 897 | Assume(entry.m_ref != nullptr); |
| 898 | if (!m_main_chunkindex_discarded.empty()) { |
| 899 | // Reuse an discarded node handle. |
| 900 | auto& node = m_main_chunkindex_discarded.back().value(); |
| 901 | node.m_graph_index = idx; |
| 902 | node.m_chunk_count = chunk_count; |
| 903 | auto insert_result = m_main_chunkindex.insert(std::move(m_main_chunkindex_discarded.back())); |
| 904 | Assume(insert_result.inserted); |
| 905 | entry.m_main_chunkindex_iterator = insert_result.position; |
| 906 | m_main_chunkindex_discarded.pop_back(); |
| 907 | } else { |
| 908 | // Construct a new entry. |
| 909 | auto emplace_result = m_main_chunkindex.emplace(idx, chunk_count); |
| 910 | Assume(emplace_result.second); |
| 911 | entry.m_main_chunkindex_iterator = emplace_result.first; |
| 912 | } |
| 913 | } |
| 914 | |
| 915 | size_t GenericClusterImpl::TotalMemoryUsage() const noexcept |
| 916 | { |