Urgent : How to do memory leaks detection in python ?
tsuraan at gmail.com
Sun Mar 16 03:56:35 CET 2008
> Python doesn't have memory leaks.
Yeah, interesting bit of trivia: python is the world's only non-trivial
program that's totally free of bugs. Pretty exciting! But seriously,
python 2.4, at least, does have some pretty trivially exposed memory leaks
when working with strings. A simple example is this:
>>> letters = [chr(c) for c in range(ord('a'), ord('z'))+range(ord('A'),
>>> ary = 
>>> for a in letters:
... for b in letters:
... for c in letters:
... for d in letters:
>>> import gc
The VM's memory usage will never drop from its high point of (on my
computer) ~200MB. Since you're using GIS data, this could be what you're
running into. I haven't been able to upgrade my systems to python 2.5, but
from my tests, that version did not have that memory leak. Nobody seems
interesting in backporting fixes from 2.5 to 2.4, so you're probably on your
own in that case as well, if upgrading to python 2.5 isn't an option or
isn't applicable to your situation.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list