mirror of
https://github.com/python/cpython.git
synced 2025-10-06 15:11:58 +00:00
gh-102304: Move the Total Refcount to PyInterpreterState (gh-102545)
Moving it valuable with a per-interpreter GIL. However, it is also useful without one, since it allows us to identify refleaks within a single interpreter or where references are escaping an interpreter. This becomes more important as we move the obmalloc state to PyInterpreterState. https://github.com/python/cpython/issues/102304
This commit is contained in:
parent
4bb1dd3c5c
commit
743687434c
13 changed files with 117 additions and 40 deletions
|
@ -483,8 +483,8 @@ void
|
|||
_PyRuntimeState_Fini(_PyRuntimeState *runtime)
|
||||
{
|
||||
#ifdef Py_REF_DEBUG
|
||||
/* The reftotal is cleared by _Py_FinalizeRefTotal(). */
|
||||
assert(runtime->object_state.reftotal == 0);
|
||||
/* The count is cleared by _Py_FinalizeRefTotal(). */
|
||||
assert(runtime->object_state.interpreter_leaks == 0);
|
||||
#endif
|
||||
|
||||
if (gilstate_tss_initialized(runtime)) {
|
||||
|
@ -904,6 +904,12 @@ PyInterpreterState_Delete(PyInterpreterState *interp)
|
|||
|
||||
_PyEval_FiniState(&interp->ceval);
|
||||
|
||||
#ifdef Py_REF_DEBUG
|
||||
// XXX This call should be done at the end of clear_interpreter(),
|
||||
// but currently some objects get decref'ed after that.
|
||||
_PyInterpreterState_FinalizeRefTotal(interp);
|
||||
#endif
|
||||
|
||||
HEAD_LOCK(runtime);
|
||||
PyInterpreterState **p;
|
||||
for (p = &interpreters->head; ; p = &(*p)->next) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue