Python not giving free memory back to the os get's me in real problems ...

leuchte at leuchte at
Wed Apr 25 16:08:42 CEST 2007

So I read quite a few things about this phenomenon in Python 2.4.x but
I can hardly believe that there is really no solution to my problem.

We use a commercial tool that has a macro functionality. These macros
are written in python. So far nothing extraordinary.

Our (python-)macro uses massively nested loops which are unfortunately
necessary. These loops perform complex calculations in this commercial
tool. To give you a quick overview how long this macros runs:

The outer loop takes 5-7 hours for one cycle. Each cycle creates one
outputfile. So we would like to perform 3-5 outer cycles en bloc.
Unfortunately one of our computers (768MB RAM) crashes after just ~10%
of the first cycle with the following error message:

while another computer (1GB RAM) crashes after ~10% of the fourth
loop. While the virtual memory on the 1gb machine was full to the
limit when it crashed the memory usage of the 768mb machine looked
this this:

The moment I close the application that launched the macro, my
ressources get freed.

So is there a way to free my memory inside my nested loops?

thanks in advance,

More information about the Python-list mailing list