Skip to content

Commit

Permalink
fix memory leaks when shrinking the tree
Browse files Browse the repository at this point in the history
  • Loading branch information
masajiro committed Aug 31, 2023
1 parent eaee806 commit 10c8e23
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.2
2.1.3
10 changes: 9 additions & 1 deletion lib/NGT/Tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,17 @@ namespace NGT {
removeNode(Node::ID id) {
size_t idx = id.getID();
if (id.getType() == Node::ID::Leaf) {
#ifndef NGT_SHARED_MEMORY_ALLOCATOR
LeafNode &n = *static_cast<LeafNode*>(getNode(id));
delete n.pivot;
#endif
leafNodes.remove(idx);
} else {
internalNodes.remove(idx);
#ifndef NGT_SHARED_MEMORY_ALLOCATOR
InternalNode &n = *static_cast<InternalNode*>(getNode(id));
delete n.pivot;
#endif
internalNodes.remove(idx);
}
}

Expand Down

0 comments on commit 10c8e23

Please sign in to comment.