-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
gh-142048: Fix lost allocations on thread cleanup #142233
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
Conversation
| // Flush the thread's local GC allocation count to the global count | ||
| // before the thread state is cleared, otherwise the count is lost. | ||
| _PyThreadStateImpl *tstate_impl = (_PyThreadStateImpl *)tstate; | ||
| _Py_atomic_add_int(&tstate->interp->gc.young.count, |
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.
Since this is less common perhaps it's ok to allow the global GC count to go negative here? The compare-and-exchange loop is more accurate though, I can update to use that if preferred.
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.
Yeah, I think going negative here is fine
|
Thanks @kevmo314 for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
…honGH-142233) (cherry picked from commit 49b1fb4) Co-authored-by: Kevin Wang <[email protected]>
|
Sorry, @kevmo314 and @kumaraditya303, I could not cleanly backport this to |
|
GH-142504 is a backport of this pull request to the 3.14 branch. |
|
GH-142506 is a backport of this pull request to the 3.13 branch. |
…up (pythonGH-142233) (cherry picked from commit 49b1fb4) Co-authored-by: Kevin Wang <[email protected]>
…up (pythonGH-142233) (cherry picked from commit 49b1fb4) Co-authored-by: Kevin Wang <[email protected]>
#142506) [3.13] gh-142048: Fix lost gc allocations count on thread cleanup (GH-142233) (cherry picked from commit 49b1fb4) Co-authored-by: Kevin Wang <[email protected]>
Fixes some lost allocation counts in the local allocation counters when threads are cleaned up.