Python's garbage collection was Re: Python reliability
twic at urchin.earth.li
Mon Oct 10 21:37:03 CEST 2005
On Mon, 10 Oct 2005, it was written:
> Ville Voipio <vvoipio at kosh.hut.fi> writes:
>> Just one thing: how reliable is the garbage collecting system? Should I
>> try to either not produce any garbage or try to clean up manually?
> The GC is a simple, manually-updated reference counting system augmented
> with some extra contraption to resolve cyclic dependencies. It's
> extremely easy to make errors with the reference counts in C extensions,
> and either leak references (causing memory leaks) or forget to add them
> (causing double-free crashes).
Has anyone looked into using a real GC for python? I realise it would be a
lot more complexity in the interpreter itself, but it would be faster,
more reliable, and would reduce the complexity of extensions.
Hmm. Maybe it wouldn't make extensions easier or more reliable. You'd
still need some way of figuring out which variables in C-land held
pointers to objects; if anything, that might be harder, unless you want to
impose a horrendous JAI-like bondage-and-discipline interface.
> There is no way you can avoid making garbage. Python conses everything,
> even integers (small positive ones are cached).
So python doesn't use the old SmallTalk 80 SmallInteger hack, or similar?
Fair enough - the performance gain is nice, but the extra complexity would
be a huge pain, i imagine.
Fitter, Happier, More Productive.
More information about the Python-list