4 ms·
Reference counting prevents that from working well. Very little sharing actually happens by default.
by dontlaugh 3y ago
Reference counting prevents that from working well. Very little sharing actually happens by default.
- sitkack 3y agoIf the counts were kept somewhere else, they wouldn't pollute, or if you could turn off ref counts for everything allocated before the call to fork, then you would also be good. The other option is you could allocate all the shared data off of the Python heap prior to the fork call.
- dontlaugh 3y agoInstagram have a system for making some objects immortal before the fork, but it’s not the default behaviour in Python. It’s also not easy to set up in some cases.
- aeyes 3y agoPEP683 finally landed in Python 3.12: https://peps.python.org/pep-0683/ https://peps.python.org/pep-0683/ It's been in Pyston for a while.