summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-06-05 00:56:37 (GMT)
committerGitHub <noreply@github.com>2020-06-05 00:56:37 (GMT)
commite005ead49b1ee2b1507ceea94e6f89c28ecf1f81 (patch)
treef2846eec88f5539825acc200c3b8a3d91a3b7d0f /Modules
parent78a02c2568714562e23e885b6dc5730601f35226 (diff)
downloadcpython-e005ead49b1ee2b1507ceea94e6f89c28ecf1f81.zip
cpython-e005ead49b1ee2b1507ceea94e6f89c28ecf1f81.tar.gz
cpython-e005ead49b1ee2b1507ceea94e6f89c28ecf1f81.tar.bz2
bpo-40521: Make context free list per-interpreter (GH-20644)
Each interpreter now has its own context free list: * Move context free list into PyInterpreterState. * Add _Py_context_state structure. * Add tstate parameter to _PyContext_ClearFreeList() and _PyContext_Fini(). * Pass tstate to clear_freelists().
Diffstat (limited to 'Modules')
-rw-r--r--Modules/gcmodule.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c
index 89e2db7..f68258d 100644
--- a/Modules/gcmodule.c
+++ b/Modules/gcmodule.c
@@ -1023,16 +1023,15 @@ delete_garbage(PyThreadState *tstate, GCState *gcstate,
* Clearing the free lists may give back memory to the OS earlier.
*/
static void
-clear_freelists(void)
+clear_freelists(PyThreadState *tstate)
{
- PyThreadState *tstate = _PyThreadState_GET();
_PyFrame_ClearFreeList(tstate);
_PyTuple_ClearFreeList(tstate);
_PyFloat_ClearFreeList(tstate);
_PyList_ClearFreeList(tstate);
_PyDict_ClearFreeList();
_PyAsyncGen_ClearFreeLists(tstate);
- _PyContext_ClearFreeList();
+ _PyContext_ClearFreeList(tstate);
}
// Show stats for objects in each generations
@@ -1306,7 +1305,7 @@ collect(PyThreadState *tstate, int generation,
/* Clear free list only during the collection of the highest
* generation */
if (generation == NUM_GENERATIONS-1) {
- clear_freelists();
+ clear_freelists(tstate);
}
if (_PyErr_Occurred(tstate)) {