Urgent : How to do memory leaks detection in python ?
Pradeep Rai
pradiprai at gmail.com
Mon Mar 17 03:21:01 EDT 2008
Thanks for your inputs !!!
I have installed python v 2.5 on my Linux machine and executing the tool
again.
I would like to share the memory status( using free -m command ) before and
after the execution of the tool.
BEFORE EXECUTION
================
total used free shared buffers
cached
Mem: 1006 148 *858* 0 8 92
-/+ buffers/cache: 46 960
Swap: 2047 0 2047
AFTER EXECUTION
===============
total used free shared buffers
cached
Mem: 1006 940 *66* 0 49 846
-/+ buffers/cache: 44 962
Swap: 2047 0 2047
I am unable to find out why *66 MB* system memory is left after tool
execution ? If python does not have memory leaks then where this memory is
going ?
I have explored few urls (as given below) related to memory leak in python :
http://www.nightmare.com/medusa/memory-leaks.html
http://mail.python.org/pipermail/tutor/1999-April/000162.html
Please comment !!!
-----Original Message-----
*From:* python-list-bounces+pradiprai=gmail.com at python.org [mailto:
python-list-bounces+pradiprai=gmail.com at python.org] *On Behalf Of *tsuraan
*Sent:* 16 March 2008 8:27 AM
*To:* python-list at python.org
*Subject:* Re: Urgent : How to do memory leaks detection in python ?
> 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'),
ord('Z'))]
>>> ary = []
>>> for a in letters:
... for b in letters:
... for c in letters:
... for d in letters:
... ary.append(a+b+c+d)
...
>>> del(ary)
>>> import gc
>>> gc.collect()
0
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...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080317/73331d45/attachment.html>
More information about the Python-list
mailing list