[Python-ideas] [Python-Dev] GC Changes

Adam Olsen rhamph at gmail.com
Tue Oct 2 03:07:47 CEST 2007


On 10/1/07, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Adam Olsen wrote:
> > Refcounting is fairly firmly ingrained in CPython, but there are
> > conservative GCs for C that mostly work,
>
> Unfortunately, "mostly works" isn't good enough for
> something to be incorporated into CPython. It needs to
> work completely reliably and very portably.

Indeed.  An example of how they can fail would be python linking the
boehm GC (which overrides malloc and free), then dynamically loading
python from another app.  By the time boehm overrides malloc and free
they've already been used significantly.

Another example is any sort of custom allocator.  At best the
conservative GC will see their heap as a single giant object (and be
unable to release objects within it).  At worst (if they allocate the
heap via mmap rather than the overridden malloc) it won't even know
the heap exists, not include it in the root set, and prematurely free
objects it references.

-- 
Adam Olsen, aka Rhamphoryncus



More information about the Python-ideas mailing list