Tracking down memory leaks?

Christos Georgiou tzot at sil-tec.gr
Tue Feb 14 02:50:42 EST 2006


On 12 Feb 2006 05:11:02 -0800, rumours say that "MKoool"
<mohankhurana at gmail.com> might have written:

>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.

Would your program work if you substituted collections.deque for the arrays
(did you mean array.arrays or lists?)?  Please test.

>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.

If your algorithms can work with the collections.deque container, can you
please check that the memory use pattern changes?

>Does anyone have any pointers on how to figure out what I'm doing
>wrong?

I suspect that you have more than one large arrays (lists?) that
continuously grow.

It would be useful if you ran your program on a fairly idle machine and had
a way to see if the consumed memory seems to be swapped out without being
swapped in eventually.
-- 
TZOTZIOY, I speak England very best.
"Dear Paul,
please stop spamming us."
The Corinthians



More information about the Python-list mailing list