Memory leak in Python

Serge Orlov Serge.Orlov at gmail.com
Wed May 10 05:20:03 EDT 2006


diffuser78 at gmail.com wrote:
> I am using Ubuntu Linux.
>
> My program is a simulation program with four classes and it mimics bit
> torrent file sharing systems on 2000 nodes. Now, each node has lot of
> attributes and my program kinds of tries to keep tab of everything. As
> I mentioned its a simulation program, it starts at time T=0 and goes on
> untill all nodes have recieved all parts of the file(BitTorrent
> concept). The ending time goes to thousands of seconds. In each sec I
> process all the 2000 nodes.

Most likely you keep references to objects you don't need, so python
garbage collector cannot remove those objects. If you cannot figure it
out looking at the source code, you can gather some statistics to help
you, for example use module gc to iterate over all objects in your
program (gc.get_objects()) and find out objects of which type are
growing with each iteration.




More information about the Python-list mailing list