[Python-ideas] Copy-on-write when forking a python process
jac
john.theman.connor at gmail.com
Fri Apr 15 16:25:42 CEST 2011
> There's a clear workaround for theCOWproblem these days: use PyPy
> instead of CPython :)
Thanks for the tip, I haven't looked at pypy in a while, it looks like
it has come a long way. I will have to change some of my code around
to work with 2.5, but it shouldn't be too bad. As far as I am
concerned, if pypy works for this, problem solved.
Thanks again,
--jac
On Apr 13, 1:17 am, Nick Coghlan <ncogh... at gmail.com> wrote:
> On Wed, Apr 13, 2011 at 7:42 AM, jac <john.theman.con... at gmail.com> wrote:
> > Has anyone else looked into theCOWproblem? Are there workarounds
> > and/or other plans to fix it? Does the solution I am proposing sound
> > reasonable, or does it seem like overkill? Does anyone see any
> > (technical) problems with it?
>
> There's a clear workaround for theCOWproblem these days: use PyPy
> instead of CPython :)
>
> Currently that workaround comes at a potentially high cost in
> compatibility with 3rd party C extensions, but that situation will
> naturally improve over time. Given that a lot of those compatibility
> problems arise *because* PyPy doesn't use refcounting natively, it's
> highly unlikely that there will be any significant tinkering with
> CPython's own approach.
>
> As far as technical problems go, opting out of memory management is a
> beautiful way to shoot yourself in the foot with memory leaks. All it
> takes is one optout() without a corresponding optin() and an arbitrary
> amount of memory may fail to be released. For example, in your own
> post, any exception in Fork_and_block_while_doing_stuff() means
> anything referenced directly or indirectly from mylist will be left
> hanging around in memory until the process terminates. That's a *far*
> worse problem than being unable to readily share memory between
> processes.
>
> Cheers,
> Nick.
>
> --
> Nick Coghlan | ncogh... at gmail.com | Brisbane, Australia
> _______________________________________________
> Python-ideas mailing list
> Python-id... at python.orghttp://mail.python.org/mailman/listinfo/python-ideas
More information about the Python-ideas
mailing list