summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_interp.h
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2023-04-24 23:23:57 (GMT)
committerGitHub <noreply@github.com>2023-04-24 23:23:57 (GMT)
commitdf3173d28ef25a0f97d2cca8cf4e64e062a08d06 (patch)
treef2b6f378f81ceee48a9e710154b9d6c4b0f959a2 /Include/internal/pycore_interp.h
parent01be52e42eac468b6511b56ee60cd1b99baf3848 (diff)
downloadcpython-df3173d28ef25a0f97d2cca8cf4e64e062a08d06.zip
cpython-df3173d28ef25a0f97d2cca8cf4e64e062a08d06.tar.gz
cpython-df3173d28ef25a0f97d2cca8cf4e64e062a08d06.tar.bz2
gh-101659: Isolate "obmalloc" State to Each Interpreter (gh-101660)
This is strictly about moving the "obmalloc" runtime state from `_PyRuntimeState` to `PyInterpreterState`. Doing so improves isolation between interpreters, specifically most of the memory (incl. objects) allocated for each interpreter's use. This is important for a per-interpreter GIL, but such isolation is valuable even without it. FWIW, a per-interpreter obmalloc is the proverbial canary-in-the-coalmine when it comes to the isolation of objects between interpreters. Any object that leaks (unintentionally) to another interpreter is highly likely to cause a crash (on debug builds at least). That's a useful thing to know, relative to interpreter isolation.
Diffstat (limited to 'Include/internal/pycore_interp.h')
-rw-r--r--Include/internal/pycore_interp.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h
index 86ae3d8..7276ce3 100644
--- a/Include/internal/pycore_interp.h
+++ b/Include/internal/pycore_interp.h
@@ -23,11 +23,12 @@ extern "C" {
#include "pycore_function.h" // FUNC_MAX_WATCHERS
#include "pycore_genobject.h" // struct _Py_async_gen_state
#include "pycore_gc.h" // struct _gc_runtime_state
+#include "pycore_global_objects.h" // struct _Py_interp_static_objects
#include "pycore_import.h" // struct _import_state
#include "pycore_instruments.h" // PY_MONITORING_EVENTS
#include "pycore_list.h" // struct _Py_list_state
-#include "pycore_global_objects.h" // struct _Py_interp_static_objects
#include "pycore_object_state.h" // struct _py_object_state
+#include "pycore_obmalloc.h" // struct obmalloc_state
#include "pycore_tuple.h" // struct _Py_tuple_state
#include "pycore_typeobject.h" // struct type_cache
#include "pycore_unicodeobject.h" // struct _Py_unicode_state
@@ -82,6 +83,8 @@ struct _is {
int _initialized;
int finalizing;
+ struct _obmalloc_state obmalloc;
+
struct _ceval_state ceval;
struct _gc_runtime_state gc;