This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients corona10, eelizondo, gregory.p.smith, nascheme, pablogsal, pitrou, steve.dower, tim.peters, vstinner
Date 2020-04-13.22:45:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The idea of immortal objects was proposed to solve the bpo-39511 problem.

I dislike immortable for different reasons. Here are some.

> We wound up not deploying it or pushing for it in CPython because the CPU performance implications of adding a branch instruction to Py_INCREC and Py_DECREF were, unsurprisingly, quite high.

Exactly. Copy-on-Write problem affects a minority of users. If PR 19474 is enabled by default, all users will pay the overhead even if they never call fork() without exec().

1.17x slower on logging_silent or unpickle_pure_python is a very expensive price :-(

> Anything that is touched by the immortal object will be leaked. This can also happen in obscure ways if reference cycles are created.

gc.freeze() has a similar issue, no? This function also comes from Instagram specific use case ;-)

> This isn't actually about removing immortal objects, but removing *mutable* objects that would be shared between subinterpreters. Making some objects immortal, such as interned strings or stateless singletons, would actually benefit this work, as they could then be safely shared between subinterpreters.

From what I understood, we simply cannot share any object (mutable or not) between two subinterpreters. Otherwise, we will need to put a lock on all Py_INCREF/Py_DECREF operation which would kill performances of running multiple interpreters in parallel. Join bpo-39511 discussion.
Date User Action Args
2020-04-13 22:45:41vstinnersetrecipients: + vstinner, tim.peters, nascheme, gregory.p.smith, pitrou, steve.dower, corona10, pablogsal, eelizondo
2020-04-13 22:45:41vstinnersetmessageid: <>
2020-04-13 22:45:41vstinnerlinkissue40255 messages
2020-04-13 22:45:41vstinnercreate