python slowdown after a longish time of running (garbage collector)

Neil Schemenauer nas at python.ca
Fri Aug 30 16:43:42 CEST 2002


Michal Vitecek wrote:
>  the problem is IMHO in the state generator that initializes lots of
>  objects (both builtin (list, tuples, dictionaries) and user made) and
>  relies on the garbage collector to clean them up when they are unused.
> 
>  the memory usage is not increasing (even after a day of running), but
>  the server (state generator) generates the states more and more slowly.

If the memory usage is not increasing then I doubt that the GC is taking
more and more time.  As Holger suggests, you can try disabling the GC.
If you are creating cyclic garbage and need the GC, you could run it
explicitly periodically and measure how much time it takes to run.
Something like:

    t = time.time()
    gc.collect()
    print 'full garbage collection took', time.time() - t

HTH,

  Neil




More information about the Python-list mailing list