mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
bpo-40521: Make list free list per-interpreter (GH-20642)
Each interpreter now has its own list free list: * Move list numfree and free_list into PyInterpreterState. * Add _Py_list_state structure. * Add tstate parameter to _PyList_ClearFreeList() and _PyList_Fini(). * Remove "#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS". * _PyGC_Fini() clears gcstate->garbage list which can be stored in the list free list. Call _PyGC_Fini() before _PyList_Fini() to prevent leaking this list.
This commit is contained in:
parent
052d3fc090
commit
88ec919010
7 changed files with 51 additions and 42 deletions
|
@ -1251,8 +1251,8 @@ finalize_interp_types(PyThreadState *tstate, int is_main_interp)
|
|||
{
|
||||
_PyFrame_Fini(tstate);
|
||||
_PyTuple_Fini(tstate);
|
||||
_PyList_Fini(tstate);
|
||||
if (is_main_interp) {
|
||||
_PyList_Fini();
|
||||
_PySet_Fini();
|
||||
_PyBytes_Fini();
|
||||
}
|
||||
|
@ -1296,6 +1296,8 @@ finalize_interp_clear(PyThreadState *tstate)
|
|||
_PyGC_CollectNoFail();
|
||||
}
|
||||
|
||||
_PyGC_Fini(tstate);
|
||||
|
||||
finalize_interp_types(tstate, is_main_interp);
|
||||
|
||||
if (is_main_interp) {
|
||||
|
@ -1309,8 +1311,6 @@ finalize_interp_clear(PyThreadState *tstate)
|
|||
|
||||
_PyExc_Fini();
|
||||
}
|
||||
|
||||
_PyGC_Fini(tstate);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue