xtensor icon indicating copy to clipboard operation
xtensor copied to clipboard

fix memory leak of npy_file's move assignment

Open qingyunqu opened this issue 2 years ago • 7 comments

Checklist

  • [x] The title and commit message(s) are descriptive.
  • [ ] Small commits made to fix your PR have been squashed to avoid history pollution.
  • [ ] Tests have been added for new features or bug fixes.
  • [ ] API of new functions and classes are documented.

Description

Fix memory leak when one npy_file move to another npy_file.

qingyunqu avatar Aug 10 '23 08:08 qingyunqu

Thanks! Sorry for not addressing this sooner. I'm not an expert on this part of the code, but I will try to help. Could you first rebase your PR on the current master in which the CI issues are fixed, such that we can take it from there?

tdegeus avatar Nov 09 '23 09:11 tdegeus

Also, could you add a test case with which we could have found this bug?

tdegeus avatar Nov 09 '23 09:11 tdegeus

This pr is stale because it has been open for 60 days with no activity. It will be automatically closed in 14 days.

github-actions[bot] avatar Jan 09 '24 01:01 github-actions[bot]

Thanks! Sorry for not addressing this sooner. I'm not an expert on this part of the code, but I will try to help. Could you first rebase your PR on the current master in which the CI issues are fixed, such that we can take it from there?

Done!

qingyunqu avatar Jan 15 '24 02:01 qingyunqu

Also, could you add a test case with which we could have found this bug?

This PR fix mem-leak of npy_file's move assignment method. It will leak when:

xt::detail::npy_file a = xt::detail::load_npy_file(fileName);
xt::detail::npy_file b = xt::detail::load_npy_file(fileName);
a = std::move(b); // original memory of a doesn't be freed before move.

qingyunqu avatar Jan 15 '24 03:01 qingyunqu

This pr is stale because it has been open for 60 days with no activity. It will be automatically closed in 14 days.

github-actions[bot] avatar Mar 17 '24 01:03 github-actions[bot]

Also, could you add a test case with which we could have found this bug?

This PR fix mem-leak of npy_file's move assignment method. It will leak when:

xt::detail::npy_file a = xt::detail::load_npy_file(fileName);
xt::detail::npy_file b = xt::detail::load_npy_file(fileName);
a = std::move(b); // original memory of a doesn't be freed before move.

Could you add this to the tests? Thanks!

tdegeus avatar Mar 19 '24 09:03 tdegeus

This pr is stale because it has been open for 60 days with no activity. It will be automatically closed in 14 days.

github-actions[bot] avatar May 19 '24 01:05 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Jun 02 '24 01:06 github-actions[bot]