-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
gh-140306: Fix memory leaks in cross-interpreter data handling #140307
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
gh-140306: Fix memory leaks in cross-interpreter data handling #140307
Conversation
Before
After
|
I've also found similar bug in |
Each variant needs to be carefully checked there, because some are correct and some aren't. I didn't look at the others because there were no leaks there :) |
I think there're leaks there, you can find them with But we can fix them in a separate PR. |
Misc/NEWS.d/next/Core_and_Builtins/2025-10-18-21-29-45.gh-issue-140306.xS5CcS.rst
Outdated
Show resolved
Hide resolved
|
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.
And please fix all other occurrences of XID_IGNORE_EXC & XID_FREE
if there are any.
Co-authored-by: Serhiy Storchaka <[email protected]>
There are no more such places in the code. |
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. 👍
Thanks @ashm-dev for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
…ythonGH-140307) (cherry picked from commit f932321) Co-authored-by: Shamil <[email protected]>
GH-140338 is a backport of this pull request to the 3.14 branch. |
Thanks @ashm-dev for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Thanks @ashm-dev for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
Sorry, @ashm-dev and @serhiy-storchaka, I could not cleanly backport this to
|
…ythonGH-140307) (cherry picked from commit f932321) Co-authored-by: Shamil <[email protected]>
Sorry @ashm-dev and @serhiy-storchaka, I had trouble completing the backport.
|
…GH-140307) (GH-140338) (cherry picked from commit f932321) Co-authored-by: Shamil <[email protected]>
…ndling (pythonGH-140307) (cherry picked from commit f932321) Co-authored-by: Shamil <[email protected]>
GH-140357 is a backport of this pull request to the 3.13 branch. |
…ndling (pythonGH-140307) (cherry picked from commit f932321) Co-authored-by: Shamil <[email protected]>
…ndling (pythonGH-140307) (cherry picked from commit f932321) Co-authored-by: Shamil <[email protected]>
…GH-140307) (GH-140357) (cherry picked from commit f932321) Co-authored-by: Shamil <[email protected]>
Fixes three memory leaks detected by LeakSanitizer in cross-interpreter operations:
_interpchannelsmodule.c
: Fixed bitwise AND (&
) incorrectly used instead of OR (|
) when combiningXID_IGNORE_EXC
andXID_FREE
flagscrossinterp.c
(_release_xid_data
): Fixed inverted ternary operator logic causing memory to be freed when it shouldn't and vice versacrossinterp.c
(_PyXI_InitFailure
): Added missingPyMem_RawFree()
call in error pathReduced memory leaks from 1565 bytes to 0 bytes in
test__interpchannels
.