diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2025-11-23-19-45-49.gh-issue-141890.99IS5Y.rst b/Misc/NEWS.d/next/Core_and_Builtins/2025-11-23-19-45-49.gh-issue-141890.99IS5Y.rst new file mode 100644 index 00000000000000..0e6c4dd907dddd --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2025-11-23-19-45-49.gh-issue-141890.99IS5Y.rst @@ -0,0 +1,2 @@ +Fix an issue where garbage collection could run less frequently than +expected. diff --git a/Python/gc.c b/Python/gc.c index d067a6144b0763..b1bf308b9c4f73 100644 --- a/Python/gc.c +++ b/Python/gc.c @@ -1618,7 +1618,6 @@ mark_at_start(PyThreadState *tstate) PyGC_Head *visited = &gcstate->old[gcstate->visited_space].head; Py_ssize_t objects_marked = mark_global_roots(tstate->interp, visited, gcstate->visited_space); objects_marked += mark_stacks(tstate->interp, visited, gcstate->visited_space, true); - gcstate->work_to_do -= objects_marked; gcstate->phase = GC_PHASE_COLLECT; validate_spaces(gcstate); return objects_marked;