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

Donald 'Paddy' McCarthy paddy3118 at
Wed Apr 25 12:56:46 EDT 2007

leuchte at wrote:
> 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,
> tim

Could you split the program into one handling the outer loop and
calling another program, with data transfer, to handle the inner

- Paddy.

More information about the Python-list mailing list