garbage collector and slowdown (guillaume weymeskirch)

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Sat Oct 4 20:34:07 EDT 2008


On Sat, 04 Oct 2008 10:57:25 -0400, Terry Reedy wrote:

> guillaume weymeskirch wrote:
>> Hello everybody,
>> 
>> 
>> To test the python 2.5 garbage collector, I wrote a trivial script
>> allocating dummy objects of various sizes, then forgetting them in a
>> loop. The garbage collector seems working well, limiting the memory
>> used.
>> 
>> But I've noticed a near linear slowdown of the execution : after a few
>> minutes - and several millions of allocated and freed objects, each
>> iteration take more and more time to execute.
> 
> On a related note, there have been past threads reporting that
> allocating and freeing increasingly long arrays, especially of tuples
> (as I remember) can take more than linearly increasing time. The
> solution was to turn off gc during the allocation phase so it did not
> get triggered and spend increasing long times searching for collectible
> objects when there were not any.


If you're talking about this thread:

http://groups.google.co.uk/group/comp.lang.python/browse_thread/thread/77e5d747c4a727cb


it turned out that gc wasn't involved, it was tuples and dicts, and it 
seemed to be hardware specific.




-- 
Steven



More information about the Python-list mailing list