From bc47246d3c18f52f3e5609bcf5135296090bc26b Mon Sep 17 00:00:00 2001 From: Haijun Yu Date: Thu, 20 Jun 2024 18:00:50 +0800 Subject: [PATCH] Fix memory index assert crash. use build_memory_index.cpp . we add and delete vector found assert crash. assert position index.cpp :2646 assert(_empty_slots.size() + _nd == _max_points); --- src/index.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/index.cpp b/src/index.cpp index bf93344fa..8b470b9e3 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -1554,6 +1554,12 @@ void Index::build_with_data_populated(const std::vector & if (pool.size() < 2) cnt++; } + + _empty_slots.clear(); + for (size_t i = _nd; _data_compacted && i < _max_points; i++) + { + _empty_slots.insert(i); + } diskann::cout << "Index built with degree: max:" << max << " avg:" << (float)total / (float)(_nd + _num_frozen_pts) << " min:" << min << " count(deg<2):" << cnt << std::endl;