Python reliability

Paul Rubin http
Mon Oct 10 08:01:17 EDT 2005


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).  The standard
libraries are pretty careful about managing references but if you're
using 3rd party C modules, or writing your own, then watch out.  

There is no way you can avoid making garbage.  Python conses
everything, even integers (small positive ones are cached).  But I'd
say, avoid making cyclic dependencies, be very careful if you use the
less popular C modules or any 3rd party ones, and stress test the hell
out of your app while monitoring memory usage very carefully.  If you
can pound it with as much traffic in a few hours as it's likely to see
in a year of deployment, without memory leaks or thread races or other
errors, that's a positive sign.

> Well... Here the uptime benefit from using several servers is not
> eceonomically justifiable. I am right now at the phase of trying to
> minimize the downtime with given hardware resources.  This is not
> flying; downtime does not kill anyone. I just want to avoid choosing
> tools which belong more to the problem than to the solution set.

You're probably ok with Python in this case.



More information about the Python-list mailing list