Skip to content

Commit

Permalink
fixed closest_set memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
kuit authored and stiartsly committed Sep 20, 2023
1 parent 3e34dba commit 8d7e04c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/task/closest_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ class ClosestSet {
closest[cn->getId()] = cn;
if (closest.size() > capacity) {
auto last = std::prev(closest.cend());
closest.erase(last);

if (last->second == cn) {
insertAttemptsSinceTailModification++;
} else {
insertAttemptsSinceTailModification = 0;
}

closest.erase(last->first);
}

const auto head = closest.cbegin()->second;
Expand Down Expand Up @@ -102,7 +102,7 @@ class ClosestSet {

private:
const Id& target;
int capacity;
int capacity {0};

std::map<Id, Sp<CandidateNode>> closest {};

Expand Down

0 comments on commit 8d7e04c

Please sign in to comment.