-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix memory leak #151
Merged
Merged
Fix memory leak #151
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ihnorton
force-pushed
the
ihn/fix_leak
branch
3 times, most recently
from
May 14, 2019 14:02
22b31da
to
d457f18
Compare
Fixes #150 PyArray_NewFromDescr ignores the NPY_ARRAY_OWNDATA flag, so we need to set it manually so that NumPy frees the memory. Because we now don't (can't) set the flag in this call, simplify construction by using PyArray_SimpleNewFromData. Now that memory is being freed correctly, we must use the NumPy allocator (PyDataMem_NEW/FREE) so that de-allocation is matched.
- we can't return the result of KV.create, because then the array will be left in read mode. - writes and reads must happen in separate Ctx to avoid hang
Must close and free before raising the error here.
Older NumPy versions don't respect NPY_ENSURECOPY in some circumstances, which means that the data in the varlen result array is no longer valid after the underlying buffer is freed.
All issues should be resolved on linux/travis. I added a new test as a basic sanity check, based on #150: read 40MB 100x, and check that RSS increase stays under 10%. |
Targeting 1.5.1 to get a CI run against that release. |
ihnorton
force-pushed
the
ihn/fix_leak
branch
4 times, most recently
from
May 17, 2019 17:21
e16ef0f
to
d1e6b3e
Compare
- Add psutil install on azure - Fix file deletion on windows
jakebolewski
approved these changes
May 17, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PyArray_NewFromDescr
ignores theNPY_ARRAY_OWNDATA
flag, so weneed to set it manually so that NumPy frees the memory.
Fixes #150