-
Notifications
You must be signed in to change notification settings - Fork 32
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
JP-3698: Fixed Memory Leak in Ramp Fitting C-Extension #281
Conversation
…eturned too early, so never decremented reference counts for python objects.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #281 +/- ##
==========================================
+ Coverage 84.32% 84.38% +0.05%
==========================================
Files 41 41
Lines 7529 7557 +28
==========================================
+ Hits 6349 6377 +28
Misses 1180 1180 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
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.
I can't speak to the details of the C changes, but empirically it looks like this has fixed the memory leak in my tests as well. Previously I saw the memory used grow by about 6-7 GB over the course of processing about 25 files from PID 1523, and with this branch that number is more like 1 GB (which I'd consider within uncertainty given how I've been measuring usage).
Thanks for the responses. Changes look good to me. Is there a link to jwst regression tests with this PR? Do you think it's worth adding a unit test to check for the re-introduction of this problem? Running main the extra references fixed in this PR can be seen (with |
I'll think of a unit test that can check the reference counts. I am working on a PR now to change all unit tests to test |
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.
Thanks for finding and fixing the bug!
…ere causing a memory leak in the ramp fitting C-extension.
I developed a unit test for this. Take a look. It creates a basic |
Thanks! EDIT: nevermind... I see where it imports the c extension directly. Looks great! |
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. Ran regression tests just to ensure no unforeseen bugs, which passed (all failures known to be from other issues): https://plwishmaster.stsci.edu:8081/job/RT/job/JWST-Developers-Pull-Requests/1669/
@nden do we need to request review from a Roman rep to get this merged?
@tapastro This doesn't need Roman approval. Feel free to merge when good. |
…eturned too early, so never decremented reference counts for python objects.
Resolves JP-3698
Closes jwst/#8680
Closes #276
This PR addresses a memory leak found in the ramp fitting C-extension. Added decrement reference counters to objects referenced that were passed from the python code. These missing decrements meant that reference counts were not properly garbage collected.
Attached is a screen shot of the memory usage from
memray
demonstrating there is no memory leak.Checklist
CHANGES.rst
(either inBug Fixes
orChanges to API
)