Skip to content
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 in MinHash.intersection. #687

Merged
merged 1 commit into from
Jun 6, 2019

Conversation

camillescott
Copy link
Contributor

The intersection function uses the new operator to construct
a KmerMinHash or KmerMinAbundance. Although this is Cython,
new still heap-allocates the object, and it is not marked
for garbage collection, because it isn't a PyObject. This commit
calls delete (del) on the allocated object to prevent it from
being leaked.

Addresses #685.

  • Is it mergeable?
  • make test Did it pass the tests?
  • make coverage Is the new code covered?
  • Did it change the command-line interface? Only additions are allowed
    without a major version increment. Changing file formats also requires a
    major version number increment.
  • Was a spellchecker run on the source code and documentation after
    changes were made?

The intersection function uses the `new` operator to construct
a `KmerMinHash` or `KmerMinAbundance`. Although this is Cython,
`new` still heap-allocates the object, and it is *not* marked
for garbage collection, because it isn't a PyObject. This commit
calls delete (`del`) on the allocated object to prevent it from
being leaked.
@codecov
Copy link

codecov bot commented Jun 6, 2019

Codecov Report

Merging #687 into master will decrease coverage by 0.14%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #687      +/-   ##
==========================================
- Coverage   89.26%   89.11%   -0.15%     
==========================================
  Files          27       27              
  Lines        4238     4237       -1     
  Branches       39       39              
==========================================
- Hits         3783     3776       -7     
- Misses        455      461       +6
Impacted Files Coverage Δ
sourmash/signature_json.py 95.62% <0%> (-1.25%) ⬇️
sourmash/lca/lca_utils.py 95.23% <0%> (-0.8%) ⬇️
sourmash/lca/command_index.py 90.3% <0%> (-0.45%) ⬇️
sourmash/sbt.py 85.32% <0%> (-0.4%) ⬇️
sourmash/sbt_storage.py 86.36% <0%> (+0.97%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ab0279a...3c8c54e. Read the comment docs.

@camillescott camillescott requested a review from luizirber June 6, 2019 19:43
@luizirber luizirber merged commit 6bd362f into master Jun 6, 2019
@luizirber luizirber deleted the fix_intersection_memleak branch June 6, 2019 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants