473,326 Members | 2,110 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

python has memory leak?

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
1 1701
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

53
by: Michael Tobis | last post by:
Someone asked me to write a brief essay regarding the value-add proposition for Python in the Fortran community. Slightly modified to remove a few climatology-related specifics, here it is. I...
10
by: Andrew Trevorrow | last post by:
No response to my last message, so I'll try a different tack... Does anyone know of, or even better, has anyone here written a C++ application for Mac/Windows that allows users to run Python...
18
by: diffuser78 | last post by:
I have a python code which is running on a huge data set. After starting the program the computer becomes unstable and gets very diffucult to even open konsole to kill that process. What I am...
0
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 378 open ( +3) / 3298 closed (+34) / 3676 total (+37) Bugs : 886 open (-24) / 5926 closed (+75) / 6812 total (+51) RFE : 224 open...
0
by: nejucomo | last post by:
Hi folks, Quick Synopsis: A test script demonstrates a memory leak when I use pythonic extensions of my builtin types, but if I use the builtin types themselves there is no memory leak. ...
5
by: vishnu | last post by:
Hi there, I am embedding python 2.5 on embedded system running on RTOS where I had strict memory constraints. As python is a huge malloc intensive application, I observed huge memory...
1
by: cody314 | last post by:
Versions: Python 2.5.1 (r251:54863, May 14 2007, 10:50:04) SWIG Version 1.3.20 Hello I have some code that wraps a C++ library so I may use it in python. The code basically just gets some data...
0
by: Gabriel Genellina | last post by:
En Wed, 16 Apr 2008 13:10:42 -0300, rkmr.em@gmail.com <rkmr.em@gmail.comescribió: In principle pure Python code should have no memory leaks - if there are, they're on Python itself. Maybe...
4
by: Christian Heimes | last post by:
Gabriel Genellina schrieb: Pure Python code can cause memory leaks. No, that's not a bug in the interpreter but the fault of the developer. For example code that messes around with stack frames...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.