Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename get_heap_size
  • Loading branch information
markshannon committed Nov 21, 2024
commit 5c3a5effc10718131a9da5b494cabfb7a5fcee29
4 changes: 2 additions & 2 deletions Lib/test/test_gc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1173,14 +1173,14 @@ def make_ll(depth):
enabled = gc.isenabled()
gc.enable()
olds = []
initial_heap_size = _testinternalcapi.get_heap_size()
initial_heap_size = _testinternalcapi.get_tracked_heap_size()
for i in range(20_000):
newhead = make_ll(20)
count += 20
newhead.surprise = head
olds.append(newhead)
if len(olds) == 20:
new_objects = _testinternalcapi.get_heap_size() - initial_heap_size
new_objects = _testinternalcapi.get_tracked_heap_size() - initial_heap_size
self.assertLess(new_objects, 25_000)
del olds[:]
if not enabled:
Expand Down
4 changes: 2 additions & 2 deletions Modules/_testinternalcapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2077,7 +2077,7 @@ has_deferred_refcount(PyObject *self, PyObject *op)
}

static PyObject *
get_heap_size(PyObject *self, PyObject *Py_UNUSED(ignored))
get_tracked_heap_size(PyObject *self, PyObject *Py_UNUSED(ignored))
{
return PyLong_FromInt64(PyInterpreterState_Get()->gc.heap_size);
}
Expand Down Expand Up @@ -2179,7 +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_heap_size", get_heap_size, METH_NOARGS},
{"get_tracked_heap_size", get_tracked_heap_size, METH_NOARGS},
{NULL, NULL} /* sentinel */
};

Expand Down