-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
Make refleak checking thread-safe without the GIL #117439
Labels
Comments
colesbury
added
type-feature
A feature request or enhancement
topic-free-threading
labels
Apr 1, 2024
colesbury
added a commit
to colesbury/cpython
that referenced
this issue
Apr 2, 2024
This keeps track of the per-thread total reference count operations in PyThreadState in the free-threaded builds. The count is merged into the interpreter's total when the thread exits.
colesbury
added a commit
to colesbury/cpython
that referenced
this issue
Apr 2, 2024
This keeps track of the per-thread total reference count operations in PyThreadState in the free-threaded builds. The count is merged into the interpreter's total when the thread exits.
colesbury
added a commit
to colesbury/cpython
that referenced
this issue
Apr 2, 2024
colesbury
added a commit
to colesbury/cpython
that referenced
this issue
Apr 2, 2024
colesbury
added a commit
to colesbury/cpython
that referenced
this issue
Apr 4, 2024
colesbury
added a commit
that referenced
this issue
Apr 8, 2024
This keeps track of the per-thread total reference count operations in PyThreadState in the free-threaded builds. The count is merged into the interpreter's total when the thread exits.
diegorusso
pushed a commit
to diegorusso/cpython
that referenced
this issue
Apr 17, 2024
…ython#117469) This keeps track of the per-thread total reference count operations in PyThreadState in the free-threaded builds. The count is merged into the interpreter's total when the thread exits.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Feature or enhancement
The refleak checking relies on per-interpreter "total" refcount tracking. It uses non-atomic operations and is not thread-safe without the GIL.
In the free-threaded build, I think we should primarily track counts in
PyThreadState
and occasionally aggregate the results into the per-interpreter total refcount using atomic operations.See:
cpython/Objects/object.c
Lines 72 to 91 in 9dae05e
There is also the legacy
_Py_RefTotal
, but that's just preserved for ABI compatibility. I don't think we have to do anything with that.Linked PRs
The text was updated successfully, but these errors were encountered: