We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e96367d commit 3900e86Copy full SHA for 3900e86
Python/pystate.c
@@ -1743,6 +1743,14 @@ PyThreadState_Clear(PyThreadState *tstate)
1743
1744
// Remove ourself from the biased reference counting table of threads.
1745
_Py_brc_remove_thread(tstate);
1746
+
1747
+ // Flush the thread's local GC allocation count to the global count
1748
+ // before the thread state is cleared, otherwise the count is lost.
1749
+ _PyThreadStateImpl *tstate_impl = (_PyThreadStateImpl *)tstate;
1750
+ _Py_atomic_add_int(&tstate->interp->gc.young.count,
1751
+ (int)tstate_impl->gc.alloc_count);
1752
+ tstate_impl->gc.alloc_count = 0;
1753
1754
#endif
1755
1756
// Merge our queue of pointers to be freed into the interpreter queue.
0 commit comments