microsoft / DiskANN

Graph-structured Indices for Scalable, Fast, Fresh and Filtered Approximate Nearest Neighbor Search
Other
1.02k stars 208 forks source link

Fix PQScratch memory leak #522

Closed luyuncheng closed 4 months ago

luyuncheng commented 5 months ago

Reference Issues/PRs

What does this implement/fix? Briefly explain your changes.

i use tcmalloc check the diskann memory which shows 2 memory leaks.

  1. in PQScratch as following code shows: https://github.com/microsoft/DiskANN/blob/a25ee6f211545c63f524b91b15abd195283cff93/src/scratch.cpp#L133-L144

it allocate aligned memory without release.

  1. in PQFlashIndex as following code shows https://github.com/microsoft/DiskANN/blob/a25ee6f211545c63f524b91b15abd195283cff93/src/pq_flash_index.cpp#L1174-L1177

it allocate memory without release

so i think we can make fix the memory leaks

Any other comments?

luyuncheng commented 5 months ago

@microsoft-github-policy-service agree

gopalrs commented 5 months ago

@luyuncheng, can you please correct the formatting of the code so that it confirms to clang-format? The formatting checks are failing.

luyuncheng commented 5 months ago

@luyuncheng, can you please correct the formatting of the code so that it confirms to clang-format? The formatting checks are failing.

@gopalrs FIXIED at https://github.com/microsoft/DiskANN/pull/522/commits/8d20a98f4557e64b87c6b9dd70a9e42a294a8878

luyuncheng commented 5 months ago

@gopalrs I FIXED Workflow Check OOM error. at https://github.com/microsoft/DiskANN/pull/522/commits/d95215131416abf7d2f279e94daafee9ab265c38 would you pls rerun the check