GH-126491: GC: Mark objects reachable from roots before doing cycle collection (GH-126502)

* Mark almost all reachable objects before doing collection phase

* Add stats for objects marked

* Visit new frames before each increment

* Remove lazy dict tracking

* Update docs

* Clearer calculation of work to do.
This commit is contained in:
Mark Shannon 2024-11-18 14:31:26 +00:00 committed by GitHub
parent a1d9c8aa80
commit b0fcc2c47a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 332 additions and 330 deletions

View file

@ -2077,6 +2077,12 @@ has_deferred_refcount(PyObject *self, PyObject *op)
}
static PyObject *
get_heap_size(PyObject *self, PyObject *Py_UNUSED(ignored))
{
return PyLong_FromInt64(PyInterpreterState_Get()->gc.heap_size);
}
static PyMethodDef module_functions[] = {
{"get_configs", get_configs, METH_NOARGS},
{"get_recursion_depth", get_recursion_depth, METH_NOARGS},
@ -2174,6 +2180,7 @@ static PyMethodDef module_functions[] = {
{"get_static_builtin_types", get_static_builtin_types, METH_NOARGS},
{"identify_type_slot_wrappers", identify_type_slot_wrappers, METH_NOARGS},
{"has_deferred_refcount", has_deferred_refcount, METH_O},
{"get_heap_size", get_heap_size, METH_NOARGS},
{NULL, NULL} /* sentinel */
};