Em Dom, 2006-02-12 às 05:11 -0800, MKoool escreveu: > I have an application with one function called "compute", which given a > filename, goes through that file and performs various statistical > analyses. It uses arrays extensively and loops alot. it prints the > results of it's statistical significance tests to standard out. Since > the compute function returns and I think no variables of global scope > are being used, I would think that when it does, all memory returns > back to the operating system. > > Instead, what I see is that every iteration uses several megs more. > For example, python uses 52 megs when starting out, it goes through > several iterations and I'm suddenly using more than 500 megs of ram. > > Does anyone have any pointers on how to figure out what I'm doing > wrong?
Have you tried to force a garbage collection? Try, for example, running gc.collect() everytime the function returns. See http://www.python.org/doc/current/lib/module-gc.html for more details. > Thanks, > mohan Cya, Felipe. -- "Quem excele em empregar a força militar subjulga os exércitos dos outros povos sem travar batalha, toma cidades fortificadas dos outros povos sem as atacar e destrói os estados dos outros povos sem lutas prolongadas. Deve lutar sob o Céu com o propósito primordial da 'preservação'. Desse modo suas armas não se embotarão, e os ganhos poderão ser preservados. Essa é a estratégia para planejar ofensivas." -- Sun Tzu, em "A arte da guerra" -- http://mail.python.org/mailman/listinfo/python-list