summaryrefslogtreecommitdiffstats
path: root/Python/pystate.c
diff options
context:
space:
mode:
authorSam Gross <colesbury@gmail.com>2024-08-08 16:48:17 (GMT)
committerGitHub <noreply@github.com>2024-08-08 16:48:17 (GMT)
commit2d9d3a9f5319ce3f850341d116b63cc51869df3a (patch)
tree6d5250d1af82d114d310655fe164c932b955ea4b /Python/pystate.c
parent833eb106f5ebbac258f236d50177712d98a36715 (diff)
downloadcpython-2d9d3a9f5319ce3f850341d116b63cc51869df3a.zip
cpython-2d9d3a9f5319ce3f850341d116b63cc51869df3a.tar.gz
cpython-2d9d3a9f5319ce3f850341d116b63cc51869df3a.tar.bz2
gh-122697: Fix free-threading memory leaks at shutdown (#122703)
We were not properly accounting for interpreter memory leaks at shutdown and had two sources of leaks: * Objects that use deferred reference counting and were reachable via static types outlive the final GC. We now disable deferred reference counting on all objects if we are calling the GC due to interpreter shutdown. * `_PyMem_FreeDelayed` did not properly check for interpreter shutdown so we had some memory blocks that were enqueued to be freed, but never actually freed. * `_PyType_FinalizeIdPool` wasn't called at interpreter shutdown.
Diffstat (limited to 'Python/pystate.c')
-rw-r--r--Python/pystate.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index 8f4818c..bba88b7 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -20,7 +20,7 @@
#include "pycore_runtime_init.h" // _PyRuntimeState_INIT
#include "pycore_sysmodule.h" // _PySys_Audit()
#include "pycore_obmalloc.h" // _PyMem_obmalloc_state_on_heap()
-#include "pycore_typeid.h" // _PyType_FinalizeIdPool
+#include "pycore_typeid.h" // _PyType_FinalizeThreadLocalRefcounts()
/* --------------------------------------------------------------------------
CAUTION