Disabling garbage colletion?

Aahz aahz at pythoncraft.com
Sat May 18 17:00:13 EDT 2002


In article <Xns92128578FD968RASXnewsDFE1 at 130.133.1.4>,
Philip Swartzleonard  <starx at pacbell.net> wrote:
>
>Hm, i just read in another post that you can turn off the garbage 
>collector? What exactly does this stop from happening? Is this a good idea 
>if e.g. you have a system which is guarenteed not to have cyclic-y 
>problems? Hm..... =)

It exactly stops the garbage collector.  ;-)  I don't know that I'd call
it a "good idea" unless you have an application that 

* Has lots of objects in memory (more than 100K objects)

* Is running too slowly

* Is CPU-bound

* You have exhausted other Python-based performance improvements

* You have tested gc.disable() and it provides a sufficient performance
boost

Generally speaking, because Python uses a generational scheme for
garbage collection, GC shouldn't be a huge drag on performance.  Like
other implementation-dependent performance optimizations, disabling GC
should be avoided.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"In the end, outside of spy agencies, people are far too trusting and
willing to help."  --Ira Winkler



More information about the Python-list mailing list