Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Commit

Permalink
fix dataset memory leak when use python api (#351)
Browse files Browse the repository at this point in the history
Signed-off-by: Yusheng.Ma <[email protected]>
  • Loading branch information
Presburger authored Aug 3, 2022
1 parent 5782019 commit e3776ff
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions python/knowhere/knowhere.i
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ DumpResultDataSet(const knowhere::DatasetPtr& result, float* dis, int nq_1, int
*(dis + i * k_1 + j) = *((float*)(dist_) + i * k_1 + j);
}
}
delete[] ids_;
delete[] dist_;
}

void
Expand All @@ -146,6 +148,7 @@ DumpRangeResultIds(const knowhere::DatasetPtr& result, int* ids, int len) {
for (int i = 0; i < len; ++i) {
*(ids + i) = *((int64_t*)(ids_) + i);
}
delete[] ids_;
}

void
Expand All @@ -154,6 +157,7 @@ DumpRangeResultLimits(const knowhere::DatasetPtr& result, int* lims, int len) {
for (int i = 0; i < len; ++i) {
*(lims + i) = *((int64_t*)(lims_) + i);
}
delete[] lims_;
}

void
Expand All @@ -162,6 +166,7 @@ DumpRangeResultDis(const knowhere::DatasetPtr& result, float* dis, int len) {
for (int i = 0; i < len; ++i) {
*(dis + i) = *((float*)(dist_) + i);
}
delete[] dist_;
}

knowhere::Config
Expand Down

0 comments on commit e3776ff

Please sign in to comment.