mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
GH-126491: GC: Mark objects reachable from roots before doing cycle collection (GH-127110)
* Mark almost all reachable objects before doing collection phase * Add stats for objects marked * Visit new frames before each increment * Update docs * Clearer calculation of work to do.
This commit is contained in:
parent
2a373da770
commit
a8dd821d5b
14 changed files with 365 additions and 113 deletions
|
|
@ -2076,6 +2076,11 @@ has_deferred_refcount(PyObject *self, PyObject *op)
|
|||
return PyBool_FromLong(_PyObject_HasDeferredRefcount(op));
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
get_tracked_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},
|
||||
|
|
@ -2174,6 +2179,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_tracked_heap_size", get_tracked_heap_size, METH_NOARGS},
|
||||
{NULL, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue