python has memory leak?

Y

yzghan

Hi all,

I feel that my python script is leaking memory. And this is a test I
have:

log.write("[" + timestamp() + "] " + "test() ... memory usage: " +
" ".join(repr(i/(1024*1024)) for i in getMemInfo()) + "\n")
m = {}
i = 1000*1000
while i > 0:
i = i - 1
m.setdefault(i, []).append(i)
log.write("[" + timestamp() + "] " + "test() ... memory usage: " +
" ".join(repr(i/(1024*1024)) for i in getMemInfo()) + "\n")
m = {}
log.write("[" + timestamp() + "] " + "test() done. memory usage: "
+ " ".join(repr(i/(1024*1024)) for i in getMemInfo()) + "\n")

From which I got:

[17:44:50] test() ... memory usage: 55L 55L
[17:44:53] test() ... memory usage: 143L 143L
[17:44:53] test() done. memory usage: 125L 143L

In the above code getMemInfo is my func to return current and peak
memory usage in bytes. Can some expert explain how python manages
memory?

The version of my python is:
Python 2.4.4 Stackless 3.1b3 060516 (#71, Oct 31 2007, 14:22:28) [MSC
v.1310 32 bit (Intel)] on win32

Many thanks,

GH
 
C

Christian Heimes

The version of my python is:
Python 2.4.4 Stackless 3.1b3 060516 (#71, Oct 31 2007, 14:22:28) [MSC
^^^^^^^^^
This is the wrong list to ask for memory leaks of Stackless ;)

Christian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,526
Members
44,997
Latest member
mileyka

Latest Threads

Top