mirror of
https://github.com/python/cpython.git
synced 2025-11-02 06:31:29 +00:00
gh-111968: Introduce _PyFreeListState and _PyFreeListState_GET API (gh-113584)
This commit is contained in:
parent
cdca0ce0ad
commit
57bdc6c30d
17 changed files with 171 additions and 50 deletions
|
|
@ -1455,6 +1455,12 @@ clear_datastack(PyThreadState *tstate)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
_Py_ClearFreeLists(_PyFreeListState *state, int is_finalization)
|
||||
{
|
||||
_PyList_ClearFreeList(state, is_finalization);
|
||||
}
|
||||
|
||||
void
|
||||
PyThreadState_Clear(PyThreadState *tstate)
|
||||
{
|
||||
|
|
@ -1537,6 +1543,11 @@ PyThreadState_Clear(PyThreadState *tstate)
|
|||
// don't call _PyInterpreterState_SetNotRunningMain() yet.
|
||||
tstate->on_delete(tstate->on_delete_data);
|
||||
}
|
||||
#ifdef Py_GIL_DISABLED
|
||||
// Each thread should clear own freelists in free-threading builds.
|
||||
_PyFreeListState *freelist_state = &((_PyThreadStateImpl*)tstate)->freelist_state;
|
||||
_Py_ClearFreeLists(freelist_state, 0);
|
||||
#endif
|
||||
|
||||
_PyThreadState_ClearMimallocHeaps(tstate);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue