Add heap_size to _gc_runtime_state

This commit is contained in:
Sergey Miryanov 2026-04-27 00:19:06 +05:00
parent c80e446e6b
commit b6ec9924fb
5 changed files with 22 additions and 4 deletions

View file

@ -2087,6 +2087,8 @@ PyObject_GC_Del(void *op)
PyGC_Head *g = AS_GC(op);
if (_PyObject_GC_IS_TRACKED(op)) {
gc_list_remove(g);
GCState *gcstate = get_gc_state();
gcstate->heap_size--;
#ifdef Py_DEBUG
PyObject *exc = PyErr_GetRaisedException();
if (PyErr_WarnExplicitFormat(PyExc_ResourceWarning, "gc", 0,