summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_interp.h
diff options
context:
space:
mode:
authorSam Gross <colesbury@gmail.com>2024-01-04 22:21:40 (GMT)
committerGitHub <noreply@github.com>2024-01-04 22:21:40 (GMT)
commitfcb3c2a444709d2a53faa20c5b43541674064018 (patch)
treec0d5d58c179a2e7d5dd1c234360c6afdb8beaf42 /Include/internal/pycore_interp.h
parentc2e8298eba3f8d75a58e5b3636f8edc8d60e68da (diff)
downloadcpython-fcb3c2a444709d2a53faa20c5b43541674064018.zip
cpython-fcb3c2a444709d2a53faa20c5b43541674064018.tar.gz
cpython-fcb3c2a444709d2a53faa20c5b43541674064018.tar.bz2
gh-112532: Isolate abandoned segments by interpreter (#113717)
* gh-112532: Isolate abandoned segments by interpreter Mimalloc segments are data structures that contain memory allocations along with metadata. Each segment is "owned" by a thread. When a thread exits, it abandons its segments to a global pool to be later reclaimed by other threads. This changes the pool to be per-interpreter instead of process-wide. This will be important for when we use mimalloc to find GC objects in the `--disable-gil` builds. We want heaps to only store Python objects from a single interpreter. Absent this change, the abandoning and reclaiming process could break this isolation. * Add missing '&_mi_abandoned_default' to 'tld_empty'
Diffstat (limited to 'Include/internal/pycore_interp.h')
-rw-r--r--Include/internal/pycore_interp.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h
index 04d7a6a..4512b1e 100644
--- a/Include/internal/pycore_interp.h
+++ b/Include/internal/pycore_interp.h
@@ -27,6 +27,7 @@ extern "C" {
#include "pycore_import.h" // struct _import_state
#include "pycore_instruments.h" // _PY_MONITORING_EVENTS
#include "pycore_list.h" // struct _Py_list_state
+#include "pycore_mimalloc.h" // struct _mimalloc_interp_state
#include "pycore_object_state.h" // struct _py_object_state
#include "pycore_obmalloc.h" // struct _obmalloc_state
#include "pycore_tstate.h" // _PyThreadStateImpl
@@ -166,6 +167,10 @@ struct _is {
struct _warnings_runtime_state warnings;
struct atexit_state atexit;
+#if defined(Py_GIL_DISABLED)
+ struct _mimalloc_interp_state mimalloc;
+#endif
+
struct _obmalloc_state obmalloc;
PyObject *audit_hooks;