By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,758 Members | 1,225 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,758 IT Pros & Developers. It's quick & easy.

python has memory leak?

P: n/a
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
Jun 27 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
yz****@gmail.com schrieb:
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

Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.