On Mon, Jun 15, 2020 at 9:21 AM Barry Scott <barry@barrys-emacs.org> wrote:
The problem is when you fork a python process.

Each of the child processes you would hope shared the state of the
parent that is not being changed. But because of ref counting
even unchanging objects get modified by a ref count inc/dec cycle
and then the page that the object is in is copy-on-write'ed.

End result is that a children share no pages with the parent.

I'm out of my depth here, but:

how many immortal objects are there? Quite a few, but they are small, yes? (None, False, True, small integers, ....) and the copy-on-write happens at the page scale (~4096k ???). So would having a bunch of small immortal objects that don't get altered really help? Maybe if they were organised to be all together.

It seems this could make a much more substantial difference if the user could mark certain objects immortal. But that would be pretty tricky -- as Python typically has a lot of small objects in containers -- how would you mark them all?

-CHB

--
Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython