Skip to content

Commit 50083e6

Browse files
committed
fix the memory error when removing objects
1 parent bb8c4a1 commit 50083e6

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.13
1+
2.3.14

lib/NGT/Graph.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,11 +1120,11 @@ void NeighborhoodGraph::removeEdgesReliably(ObjectID id) {
11201120
if ((ei == n.end()) || ((*ei).id != obj.id)) {
11211121
auto idx = distance(n.begin(), ei);
11221122
bool found = false;
1123-
for (int i = idx - 1; idx >= 0 && found == false; i--) {
1123+
for (int i = idx - 1; i >= 0 && found == false; i--) {
11241124
if (n[idx - 1].distance != n[i].distance) break;
11251125
if (n[i].id == obj.id) found = true;
11261126
}
1127-
for (int i = idx + 1; idx < (static_cast<int>(n.size()) - 1) && found == false; i++) {
1127+
for (int i = idx + 1; i < (static_cast<int>(n.size()) - 1) && found == false; i++) {
11281128
if (n[idx + 1].distance != n[i].distance) break;
11291129
if (n[i].id == obj.id) found = true;
11301130
}
@@ -1158,11 +1158,11 @@ void NeighborhoodGraph::removeEdgesReliably(ObjectID id) {
11581158
if ((ei == n.end()) || ((*ei).id != obj.id)) {
11591159
auto idx = distance(n.begin(), ei);
11601160
bool found = false;
1161-
for (int i = idx - 1; idx >= 0 && found == false; i--) {
1161+
for (int i = idx - 1; i >= 0 && found == false; i--) {
11621162
if (n[idx - 1].distance != n[i].distance) break;
11631163
if (n[i].id == obj.id) found = true;
11641164
}
1165-
for (int i = idx + 1; idx < (static_cast<int>(n.size()) - 1) && found == false; i++) {
1165+
for (int i = idx + 1; i < (static_cast<int>(n.size()) - 1) && found == false; i++) {
11661166
if (n[idx + 1].distance != n[i].distance) break;
11671167
if (n[i].id == obj.id) found = true;
11681168
}

lib/NGT/Index.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,8 +781,6 @@ void NGT::Index::remove(const string &database, vector<ObjectID> &objects, bool
781781
for (vector<ObjectID>::iterator i = objects.begin(); i != objects.end(); i++) {
782782
try {
783783
index.remove(*i, force);
784-
std::cerr << "create index" << std::endl;
785-
index.createIndex(16);
786784
} catch (Exception &err) {
787785
cerr << "Warning: Cannot remove the node. ID=" << *i << " : " << err.what() << endl;
788786
continue;

lib/NGT/NGTQ/QbgCli.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,7 @@ void QBG::CLI::load(NGT::Args &args) {
854854

855855
void QBG::CLI::search(NGT::Args &args) {
856856
const string usage = "Usage: qbg search [-i g|t|s] [-n result-size] [-e epsilon] [-m mode(r|l|c|a)] "
857+
"[-B blob-epsilon] "
857858
"[-E edge-size] [-o output-mode] [-b result expansion(begin:end:[x]step)] "
858859
"index(input) query.tsv(input)";
859860
args.parse("v");

0 commit comments

Comments
 (0)