summaryrefslogtreecommitdiffstats
path: root/Python/gc.c
diff options
context:
space:
mode:
authorDonghee Na <donghee.na@python.org>2024-01-09 23:04:41 (GMT)
committerGitHub <noreply@github.com>2024-01-09 23:04:41 (GMT)
commit57bdc6c30d2665c2760ff5a88487e57c8b3c397a (patch)
treede5a4efb2a25eac14672c6a538ca6e50ae7ed582 /Python/gc.c
parentcdca0ce0ad47604b7007229415817a7a152f7f9a (diff)
downloadcpython-57bdc6c30d2665c2760ff5a88487e57c8b3c397a.zip
cpython-57bdc6c30d2665c2760ff5a88487e57c8b3c397a.tar.gz
cpython-57bdc6c30d2665c2760ff5a88487e57c8b3c397a.tar.bz2
gh-111968: Introduce _PyFreeListState and _PyFreeListState_GET API (gh-113584)
Diffstat (limited to 'Python/gc.c')
-rw-r--r--Python/gc.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/Python/gc.c b/Python/gc.c
index f47c74f..9f9a755 100644
--- a/Python/gc.c
+++ b/Python/gc.c
@@ -1019,21 +1019,6 @@ delete_garbage(PyThreadState *tstate, GCState *gcstate,
}
}
-/* Clear all free lists
- * All free lists are cleared during the collection of the highest generation.
- * Allocated items in the free list may keep a pymalloc arena occupied.
- * Clearing the free lists may give back memory to the OS earlier.
- */
-static void
-clear_freelists(PyInterpreterState *interp)
-{
- _PyTuple_ClearFreeList(interp);
- _PyFloat_ClearFreeList(interp);
- _PyList_ClearFreeList(interp);
- _PyDict_ClearFreeList(interp);
- _PyAsyncGen_ClearFreeLists(interp);
- _PyContext_ClearFreeList(interp);
-}
// Show stats for objects in each generations
static void
@@ -1449,7 +1434,7 @@ gc_collect_main(PyThreadState *tstate, int generation, _PyGC_Reason reason)
/* Clear free list only during the collection of the highest
* generation */
if (generation == NUM_GENERATIONS-1) {
- clear_freelists(tstate->interp);
+ _PyGC_ClearAllFreeLists(tstate->interp);
}
if (_PyErr_Occurred(tstate)) {