[Python-Dev] Calling the GC less often when there are lots of long-lived objects
solipsis at pitrou.net
Tue Dec 16 22:53:23 CET 2008
There are recurring complaints about the garbage collector degrading performance
when lots of objects are created in a row. In issue #4074, I've proposed a patch
which basically implements Martin's suggestion in
http://mail.python.org/pipermail/python-dev/2008-June/080579.html to base the
decision to do a full collection on the ratio between the number of objects
surviving the (n-1) generation collection and the number of long-lived objects.
I've also added a condition so that this new behaviour is only triggered when
there are more than 10000 long-lived objects -- therefore, cycles will still get
collected quickly in lightweight programs. In Gregory's simple test of storing
many tuples in a list, the behaviour has indeed changed from exponential to
Is anybody opposed to the principle of this proposal?
More information about the Python-Dev