Is this a bug? Python intermittently stops dead for seconds

Roel Schroeven rschroev_nospam_ml at fastmail.fm
Sun Oct 1 12:48:22 EDT 2006


Charlie Strauss schreef:
> On Oct 1, 2006, at 9:48 AM, Fredrik Lundh wrote:
>> charlie strauss wrote:
>>> Could you clarify that for me.  GC really has three components
>>> two it:  1) finding and freeing unrefernced memory by refer
>>> refer counts 2)  cycle removal and 3)  defragementing the
>>> storage stack.  If I turn off GC, don't I lose all of these?
>>>
>> CPython always does (1), only does (2) if cycle-breaking GC isn't
>> disabled, and never does (3).
> 
[snip]
> And just to be clear: are you saying that when I do a gc.disable this  
> only turns off 2 and not 1?  The docs don't say that as far as I can  
> tell.

AFAIK Python always does reference counting, and the garbage collector 
is used only for more difficult cases. As the gc module docs say:
"Since the collector supplements the reference counting already used in 
Python, you can disable the collector if you are sure your program does 
not create reference cycles."

I don't know if that's only true for CPython or also for the other 
implementations.

-- 
If I have been able to see further, it was only because I stood
on the shoulders of giants.  -- Isaac Newton

Roel Schroeven



More information about the Python-list mailing list