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 -- http://mail.python.org/mailman/listinfo/python-list