| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Use per-thread refcounting for the reference from function objects to their corresponding code object. This can be a source of contention when frequently creating nested functions. Deferred refcounting alone isn't a great fit here because these references are on the heap and may be modified by other libraries.
|
🤖 New build scheduled with the buildbot fleet by @colesbury for commit 018b2a1 🤖 If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again. |
Sorry, something went wrong.
|
This seems like we are adding more code, rather than reusing the existing code for per-thread refcounts already in existence for classes. |
Sorry, something went wrong.
|
It is factored out and reusing existing code. That's why _Py_INCREF_CODE and _Py_DECREF_CODE are only one line each. What concretely would you like changed? |
Sorry, something went wrong.
|
Quite a lot of code is being added to pycore_object.h, but I don't see code being removed from typeobject.c or wherever the code for per-thread reference counts for classes is. |
Sorry, something went wrong.
|
What would you like to see changed? pycore_object.h is +22 lines. That doesn't seem like quite a lot to me. That is:
|
Sorry, something went wrong.
| static inline void | ||
| _Py_DECREF_CODE(PyCodeObject *co) | ||
| { | ||
| _Py_THREAD_DECREF_OBJECT((PyObject *)co, co->_co_unique_id); |
There was a problem hiding this comment.
assert that co is a code object.
Sorry, something went wrong.
There was a problem hiding this comment.
co is statically a PyCodeObject *. We don't typically dynamically check the type when we have the static type (e.g., in PyCode_Addr2Line)
Sorry, something went wrong.
There was a problem hiding this comment.
I meant it to be protect against incorrect casts, anyways it's minor.
Sorry, something went wrong.
| static inline void | ||
| _Py_INCREF_CODE(PyCodeObject *co) | ||
| { | ||
| _Py_THREAD_INCREF_OBJECT((PyObject *)co, co->_co_unique_id); |
There was a problem hiding this comment.
Same add assert to check it is codeobject
Sorry, something went wrong.
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
|
!buildbot AMD64 Fedora Stable Refleaks |
Sorry, something went wrong.
|
🤖 New build scheduled with the buildbot fleet by @colesbury for commit 7ad129b 🤖 The command will test the builders whose names match following regular expression: AMD64 Fedora Stable Refleaks The builders matched are:
|
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM - just some comment fixups inline.
Sorry, something went wrong.
Co-authored-by: mpage <mpage@cs.stanford.edu>
| Back | FazBrowse Home | New Git URL |
Use per-thread refcounting for the reference from function objects to their corresponding code object. This can be a source of contention when frequently creating nested functions. Deferred refcounting alone isn't a great fit here because these references are on the heap and may be modified by other libraries.
We will still need to address the globals and builtins dictionaries in a similar way.