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

Fwd: Memory leak in python

P: n/a
Hi Nick,

Thanks for reply... Please include me in reply.
Currently i am not in the list (i will subscribe soon)

I upgarded to 2.4.1 - still the same issue.

Nick>
Thats not a lot of leak - have you done that over a
longer time period?

Abhi>
I have tried for 4 days. It has reached 150MB.

Nick>
Are there any objects in gc.garbage?
gc.set_debug(gc.DEBUG_LEAK)
gc.get_debug( ) 62 gc.collect() 0 gc.garbage []
Abhi>
There is none.

Nick>
Are you writing objects with __del__ methods? If so
then that is your problem probably.

Abhi>
I have not written any __del__ methods.

Nick>
Have you written any C extension modules in C?

Yes. Many - All of them are called only
when the app starts. And never called again.
Till then it is stable only - 16MB used.

I have tried following - let me know if you need any
more details.. and want me to try something.

1)
I found a "sizer" python program. Which gives me the
module which is growing. It indicates that __main__ is
growing.

__main__': 4000774

2) I tried following.. (not smart but..)

def f():
c = gc.get_objects()
j = 0
for i in c:
j = j + 1
try:
tmp = len(i)
if tmp > 1000:
print "(c[%d]) (%d)," % (j-1, tmp)
except:
pass

it prints me as folows:

l(c[175]) (7336),
l(c[12475]) (1260),
l(c[12477]) (1260),
l(c[12479]) (1381),
l(c[12481]) (1381),
l(c[34159]) (1200),
l(c[37144]) (28234),
l(c[37191]) (28286), type(c[37191]) <type 'dict'> for k,v in c[37164].items():

.... print k, v
.... b = b + 1
.... if b > 30:
.... break
....
1085115764 620
1080048556 2
1085045932 4
1085146316 1
1085246700 2
1090615060 9
1089571940 2
1090519084 2
1090876932 234
1093456364 48
1085168140 2
1089964748 6
1089994828 0
1090095684 69
1076932268 2
1085014108 6
1080092204 10
1084888812 1
1118543628 48
1089994860 6
1076731524 6
1079640188 3
1084883076 15
1079712492 1
1118459244 64
1080295564 1
1076522028 4
1085211788 2
1076887700 20
1076729756 70
1091012236 2

This two dict in the last is growing slowly..
I am not maintaing any dict with such indices and
value.

Any clue?
Please let me know what else to check and how!

At the time i am ending this.. module size..
'__main__': 7926830,

Thanks,
Abhishek

Note: forwarded message attached.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.