Memory leak when creating lots of object

Godzilla godzillaismad at gmail.com
Thu Aug 16 23:51:28 EDT 2007


On Aug 16, 1:13 am, Paul  Moore <p.f.mo... at gmail.com> wrote:
> On 14 Aug, 05:57, Godzilla <godzillais... at gmail.com> 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
growing...

I have a pdu.py 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 pdu.py, 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