Memory leak when creating lots of object

Godzilla godzillaismad at
Fri Aug 17 05:51:28 CEST 2007

On Aug 16, 1:13 am, Paul  Moore < at> wrote:
> On 14 Aug, 05:57, Godzilla <godzillais... at> wrote:
> > Hello,
> > I have a program that create and pop an object off a queue, but it is
> > experiencing some memory leakage. I have been unable to detect where
> > the memory leakage occur. The strange thing is when i replace the
> > object creation with a plain integer/string, the leak goes away...
> > Here's the code I used as my test:
> [...]
> > I can see the memory usage increases slowly in Task Manager under XP,
> > but do not know why. Anyone help?
> I tried your code on my (Windows XP SP2, Python 2.5) system. No memory
> leak here - I left it running for over 5 minutes and memory usage was
> static at just under 4MB.
> Do you see memory growth with precisely this code? Over what period?
> How much?
> Paul.

Hi Paul,

I have it running for more than 1 hour... the main application
software runs for about 50 days non stops and the memory just keep

I have a class which has about 130 methods that's been created
on the fly. If you substitute the above code of PDU() init with the
pdu class from, I see a dramatic increase in RAM in python
2.4.4! But not in version 2.5.1. So I upgraded to the latest
version... I still see the main application uses more and more memory
as the time goes by...

What should I do next? Can I force garbage collection manually? If so,
how do I do that?

More information about the Python-list mailing list