Repository navigation
Fix elem_dtype reference leak in conv_vlen2ndarray - #2991
Open
barlowa124 wants to merge 1 commit into
Open
barlowa124 wants to merge 1 commit into
barlowa124 wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2991 +/- ##
=======================================
Coverage 90.51% 90.51%
=======================================
Files 16 16
Lines 2551 2551
=======================================
Hits 2309 2309
Misses 242 242 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or 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
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.
Fixes #2839.
Reading a variable-length dataset leaks one reference on the element
dtype for every element converted. A 50-item vlen-int dataset read
ten times leaves 500 extra references on
np.dtype('int64').The leak is in
conv_vlen2ndarray(h5py/_conv.templ.pyx), whichcalls
Py_INCREF(elem_dtype)for each element. That argument isborrowed, and none of the output paths consume the incref:
PyArray_SimpleNewFromData,np.frombuffer, andnp.emptyplusmemcpyeach obtain their own dtype reference.This drops the unbalanced incref. Refcounts stay flat across
repeated reads and returned arrays are unchanged.
TestVlengains a regression test asserting the element dtyperefcount does not grow across repeated vlen reads. The vlen
selections of
test_dtype.pyandtest_dataset.pypass here.A news fragment is included.