python 1.5.2 memory leak?

Alex Martelli aleaxit at yahoo.com
Fri Nov 17 13:24:04 CET 2000


"Taz" <tariq.rashid at iname.com> wrote in message
news:2J8R5.292$JE1.5619 at news2-win.server.ntlworld.com...
> i'm not very experienced - so the answer may be obvious...
>
> i'm running python code that "runs forver" like daemons. i see that the
> memory allocated to it keeps growing using ktop....
>
> i have  taken care to close all objects like file.close() ...
> socket.close() -- using the python essential reference book - so i don't
> think i;ve lost anything?

I guess you probably have some circular-reference-loops around...


> can i force garbage collection?

Not on Python 1.5.2: it was introduced in 2.0


> i;'m using python 1.5.2 on redhat 6.2 and mandrake 7.1

Why don't you try installing 2.0 and see if it helps... if it
doesn't, I think that means some objects in your loops have
a __del__ method (and thus aren't getting collected).

Even if your program must eventually run under 1.5.2 for
some reason, the gc module in 2.0 will be useful to you
anyway -- gc.set_debug(gc.DEBUG_LEAK), etc...


Alex






More information about the Python-list mailing list