]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-101659: Isolate "obmalloc" State to Each Interpreter (gh-101660)
authorEric Snow <ericsnowcurrently@gmail.com>
Mon, 24 Apr 2023 23:23:57 +0000 (17:23 -0600)
committerGitHub <noreply@github.com>
Mon, 24 Apr 2023 23:23:57 +0000 (17:23 -0600)
commitdf3173d28ef25a0f97d2cca8cf4e64e062a08d06
treef2b6f378f81ceee48a9e710154b9d6c4b0f959a2
parent01be52e42eac468b6511b56ee60cd1b99baf3848
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.
20 files changed:
Include/cpython/initconfig.h
Include/cpython/pystate.h
Include/internal/pycore_interp.h
Include/internal/pycore_obmalloc.h
Include/internal/pycore_obmalloc_init.h
Include/internal/pycore_pylifecycle.h
Include/internal/pycore_pystate.h
Include/internal/pycore_runtime.h
Include/internal/pycore_runtime_init.h
Lib/test/test_capi/test_misc.py
Lib/test/test_embed.py
Lib/test/test_import/__init__.py
Lib/test/test_threading.py
Modules/_testcapimodule.c
Objects/object.c
Objects/obmalloc.c
Python/pylifecycle.c
Python/pystate.c
Python/sysmodule.c
Tools/c-analyzer/cpython/ignored.tsv