Garbage collection

Tom Wright tew24 at
Wed Mar 21 18:19:44 CET 2007

Steve Holden wrote:
> Easy to say. How do you know the memory that's not in use is in a
> contiguous block suitable for return to the operating system? I can
> pretty much guarantee it won't be. CPython doesn't use a relocating
> garbage collection scheme

Fair point.  That is difficult and I don't see a practical solution to it
(besides substituting a relocating garbage collector, which seems like a
major undertaking).

> Right. So all we have to do is identify those portions of memory that
> will never be read again and return them to the OS. That should be easy.
> Not.

Well, you have this nice int free list which points to all the bits which
will never be read again (they might be written to, but if you're writing
without reading then it doesn't really matter where you do it).  The point
about contiguous chunks still applies though.

I'm at CAMbridge, not SPAMbridge

More information about the Python-list mailing list