On Tue, Dec 14, 2021 at 4:09 PM Brett Cannon <brett@python.org> wrote:
There's also the concern of memory usage if these immortal objects are never collected.
But which objects are immortal? You only listed None, True, and False. Otherwise assume/remember I'm management and provide a list and/or link of what would get marked as immortal so we can have an idea of the memory impact.
Pretty much we would mark any object as immortal which would exist for the lifetype of the runtime (or the respective interpreter in some cases). So currently that would include the global singletons (None, True, False, small ints, empty tuple, etc.) and the static types. We would likely also include cached strings (_Py_Identifier, interned, etc.). From another angle: I'm working on static allocation for nearly all the objects currently dynamically allocated during runtime/interpreter init. All of them would be marked immortal. This is similar to the approach taken by Eddie with walking the heap and marking all objects found. -eric