/util/normalize/

id='header'> cgit logo index : cpython.git
https://github.com/python/cpython.git
summaryrefslogtreecommitdiffstats
path: root/Python/pystate.c
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2022-01-12 23:28:46 (GMT)
committerGitHub <noreply@github.com>2022-01-12 23:28:46 (GMT)
commited57b36c32e521162dbb97199e64a340d3bff827 (patch)
treefab825ae903723e4dc748e7b89cb78f3b226c816 /Python/pystate.c
parent0bbf30e2b910bc9c5899134ae9d73a8df968da35 (diff)
downloadcpython-ed57b36c32e521162dbb97199e64a340d3bff827.zip
cpython-ed57b36c32e521162dbb97199e64a340d3bff827.tar.gz
cpython-ed57b36c32e521162dbb97199e64a340d3bff827.tar.bz2
bpo-45953: Statically allocate the main interpreter (and initial thread state). (gh-29883)
Previously, the main interpreter was allocated on the heap during runtime initialization. Here we instead embed it into _PyRuntimeState, which means it is statically allocated as part of the _PyRuntime global. The same goes for the initial thread state (of each interpreter, including the main one). Consequently there are fewer allocations during runtime/interpreter init, fewer possible failures, and better memory locality. FYI, this also helps efforts to consolidate globals, which in turns helps work on subinterpreter isolation. https://bugs.python.org/issue45953
Diffstat (limited to 'Python/pystate.c')
-rw-r--r--Python/pystate.c49
1 files changed, 33 insertions, 16 deletions
diff --git a/Python/pystate.c b/Python/pystate.c