garbage collector and slowdown (guillaume weymeskirch)
Terry Reedy
tjreedy at udel.edu
Sat Oct 4 10:57:25 EDT 2008
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.
More information about the Python-list
mailing list