[Python-ideas] Copy-on-write when forking a python process

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Apr 16 02:03:48 CEST 2011


Nick Coghlan wrote:
> On Fri, Apr 15, 2011 at 7:10 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> 
>>Doesn't PyPy use a copying collector? Wouldn't that mean that the first
>>garbage collector pass after the fork() would un-share the memory pages
>>anyway?
> 
> I'm fairly sure one of the PyPy talks at Pycon specifically mentioned
> the CoW problem as one of the ways PyPy was able to save memory over
> CPython.

The answer is probably something along the lines that only the most
active parts of the heap get copied and the rest are left alone
most of the time. Otherwise copying GCs would be really bad for other
reasons too, such as causing a lot of paging and cache invalidation.

-- 
Greg



More information about the Python-ideas mailing list