[PyKDE] memleak with QMovie

Phil Thompson phil at riverbankcomputing.co.uk
Sun Sep 18 23:13:02 BST 2005


On Sunday 18 September 2005 10:11 pm, Russell Valentine wrote:
> Phil Thompson said the following on 09/18/05 14:07:
> > On Sunday 18 September 2005 6:12 pm, Russell Valentine wrote:
> >>Phil Thompson said the following on 09/18/05 05:18:
> >>>On Sunday 18 September 2005 9:04 am, Russell Valentine wrote:
> >>>>I've been seeing a mem leak in my PyKDE application for several months.
> >>>>I figured it was because I upgraded KDE to 3.4 or something because I
> >>>>saw it around that time. I finally made my self try to figure out where
> >>>>the leak was coming from and narrowed it down to QMovie.
> >>>
> >>>Difficult to see how this would be a PyQt problem. I'd try a C++ version
> >>>and see if the problem is still there.
> >>>
> >>>Phil
> >>
> >>I tried a C++ version and I see no memory leak. So it seems localized to
> >>something with PyQt. Attached is a tar with the C++ code and the python
> >>one for comparison.
> >
> > They both do the same thing for me - which is nothing. Am I missing
> > something? The Qt movies example plays the file fine.
> >
> > Phil
>
> So the python example on your system doesn't eventually use up a lot of
> memory?
>
> For example on my system:
>
> $ python memleak.py& ps auxw| head -n 1|awk '{ print $4" "$11"
> "$12}';while `/bin/true`; do
> ps auxw|grep memleak | grep -v grep | awk '{ print $4" "$11" "$12}'
> sleep 60
> done
>
> OUTPUT:
> %MEM COMMAND
> 2.1 python memleak.py
> 2.3 python memleak.py
> 2.5 python memleak.py
> 2.7 python memleak.py
> 2.9 python memleak.py
> 3.0 python memleak.py
> 3.2 python memleak.py
> ... higher %MEM everytime
>
> If I run it for a few hours, all my RAM is being used by python. Comment
> out the QMovie statement and the memory usage is constant.
>
> As compared to the C++ version of the program on my system.
>
> $ ./memleak& ps auxw| head -n 1|awk '{ print $4" "$11" "$12}';while
> `/bin/true`; do
> ps auxw|grep memleak | grep -v grep | awk '{ print $4" "$11" "$12}'
> sleep 60
> done
>
> OUTPUT:
> %MEM COMMAND
> 1.4 ./memleak
> 1.4 ./memleak
> 1.4 ./memleak
> 1.4 ./memleak
> 1.4 ./memleak
> 1.4 ./memleak
> 1.4 ./memleak
> 1.4 ./memleak
> ... constant mem usage
>
>
> The python version without QMovie:
>
> $ python memleak-noqmovie.py& ps auxw| head -n 1|awk '{ print $4" "$11"
> "$12}';while `/bin/true`; do
> ps auxw|grep memleak | grep -v grep | awk '{ print $4" "$11" "$12}'
> sleep 60
> done
>
> OUTPUT:
> %MEM COMMAND
> 1.9 python memleak-noqmovie.py
> 2.0 python memleak-noqmovie.py
> 2.0 python memleak-noqmovie.py
> 2.0 python memleak-noqmovie.py
> 2.0 python memleak-noqmovie.py
> 2.0 python memleak-noqmovie.py
> 2.0 python memleak-noqmovie.py
> 2.0 python memleak-noqmovie.py
> 2.0 python memleak-noqmovie.py
> 2.0 python memleak-noqmovie.py
> 2.0 python memleak-noqmovie.py
> ... constant mem usage
>
>
> So if it isn't doing it on your system, I wonder what is different with
> mine that causes this. It does it on two of my systems Debian and
> Gentoo. Alright then, if it was just me sorry to bother you, I thought I
> was onto something. If I ever figure out the reason for this I'll post
> it in case anyone was curious.

No, I'm saying that I don't think your test is working for me. Is the movie 
supposed to be played - as it does with the Qt movie example?

Phil




More information about the PyQt mailing list