mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-100240: Use a consistent implementation for freelists (#121934)
This combines and updates our freelist handling to use a consistent implementation. Objects in the freelist are linked together using the first word of memory block. If configured with freelists disabled, these operations are essentially no-ops.
This commit is contained in:
parent
2408a8a22b
commit
5716cc3529
27 changed files with 295 additions and 705 deletions
|
@ -9,6 +9,7 @@
|
|||
#include "pycore_dict.h" // _PyDict_Fini()
|
||||
#include "pycore_exceptions.h" // _PyExc_InitTypes()
|
||||
#include "pycore_fileutils.h" // _Py_ResetForceASCII()
|
||||
#include "pycore_freelist.h" // _PyObject_ClearFreeLists()
|
||||
#include "pycore_floatobject.h" // _PyFloat_InitTypes()
|
||||
#include "pycore_global_objects_fini_generated.h" // "_PyStaticObjects_CheckRefcnt()
|
||||
#include "pycore_import.h" // _PyImport_BootstrapImp()
|
||||
|
@ -1843,7 +1844,7 @@ finalize_interp_types(PyInterpreterState *interp)
|
|||
#ifndef Py_GIL_DISABLED
|
||||
// With Py_GIL_DISABLED:
|
||||
// the freelists for the current thread state have already been cleared.
|
||||
struct _Py_object_freelists *freelists = _Py_object_freelists_GET();
|
||||
struct _Py_freelists *freelists = _Py_freelists_GET();
|
||||
_PyObject_ClearFreeLists(freelists, 1);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue