SIGN IN SIGN UP

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
E
Eric Snow committed
ed57b36c32e521162dbb97199e64a340d3bff827
Parent: 0bbf30e
Committed by GitHub <noreply@github.com> on 1/12/2022, 11:28:46 PM