Fix memory leak, temp solution

Signed-off-by: FluorineDog <guilin.gou@zilliz.com>
pull/4973/head^2
FluorineDog 2021-04-19 16:39:23 +08:00 committed by yefu.chen
parent 6deba1faa5
commit 43b39cc9c9
1 changed files with 15 additions and 0 deletions

View File

@ -56,6 +56,17 @@ AssembleNegBitset(const BitsetSimple& bitset_simple) {
return result;
}
// TODO: temporary fix
// remove this when internal destructor bug is fix
static void
ReleaseQueryResult(const knowhere::DatasetPtr& result) {
float* res_dist = result->Get<float*>(knowhere::meta::DISTANCE);
free(res_dist);
int64_t* res_ids = result->Get<int64_t*>(knowhere::meta::IDS);
free(res_ids);
}
void
SearchOnSealed(const Schema& schema,
const segcore::SealedIndexingRecord& record,
@ -95,5 +106,9 @@ SearchOnSealed(const Schema& schema,
std::copy_n(ids, total_num, result.internal_seg_offsets_.data());
std::copy_n(distances, total_num, result.result_distances_.data());
// TODO: temporary fix
// remove this when internal destructor bug is fix
ReleaseQueryResult(final);
}
} // namespace milvus::query