[mythtv-users] Memory leak while watching MPEG-2 recording?

aaron memoryguy at gmail.com
Sat Mar 19 13:50:50 UTC 2011


Over the past few weeks I've been having a lot of issue with various
pieces of Myth (backend, filldatabase, etc) crashing, seemingly at
random. I was chalking it up to failing hardware, mainly because I
didn't have the time to invest in debugging (was getting ready for a
two-week vacation). But, I did notice that the start of the crashing
suspiciously coincided with an upgrade of the myth app (I am running

Anyway, I put in some workarounds to minimize the damage and went away
to enjoy my vacation.

After I came back, I upgraded to latest master and discovered, to my
joy, that the crashing seems to have stopped. My girlfriend and I are
very happy.

But, last night we sat down to watch some recorded stuff and about
halfway through the first program playback started getting really
jerky. I figured the backend was recording something or doing
housekeeping or somesuch, so I tried to ignore it.

But then I took a closer look and saw that the frontend was consuming
a rather large chunk of memory and kept increasing by 1 MB (according
to the VIRT column in htop) every few seconds (we were watching the
show at 2x timestretch)

This becomes a problem about halfway through a program probably
because my system has 512 MB of RAM and that's probably when the
paging becomes noticeable. But that's a guess.

So, this morning I installed valgrind and upgraded again to the latest master:

myth at myth:~$ mythfrontend --version
Please attach all output as a file in bug reports.
MythTV Version   : v0.25pre-1461-g9dc6c39
MythTV Branch    : master
Network Protocol : 65
Library API      : 0.25.20110310-1
QT Version       : 4.5.1
Options compiled in:
 linux release use_hidesyms using_alsa using_oss using_backend
using_bindings_perl using_bindings_python using_bindings_php using_dvb
using_frontend using_hdhomerun using_hdpvr using_iptv using_ivtv
using_libxml2 using_libudf using_lirc using_mheg using_qtdbus
using_qtwebkit using_v4l using_x11 using_xrandr using_xv
using_bindings_perl using_bindings_python using_bindings_php
using_mythtranscode using_opengl using_ffmpeg_threads using_live
using_mheg using_libxml2 using_libudf

and tried to run:

myth at myth:~$ valgrind --leak-check=full --error-limit=no
--show-reachable=yes mythfrontend -O UIPainter=qt

(I think I had previously commented that not overriding the painter
makes X crash... yes, I need a new system :) )

Unfortunately, I wasn't able to run the backend long enough to see a
leak; VIRT was up to 900MB+ and audio was skipping badly and video was
"stuck". And the whole thing ran too slowly to get far enough to see
much of a leak.

Is there any suggestion on how I might be able to capture a meaningful
valgrind log?

When I tried to exit playback, valgrind complained that it hit a SEGV
and then dumped a bunch of output (and like a fool I wasn't capturing
it to a file, since it was a test run),  but it did seem to report
that a few MB were leaked. But, given that it terminated with SEGV I
don't know how trustworthy that is.

On a side note, my frontend doesn't tend to SEGV much in normal operation...

My system is:
AthlonXP 2800+
512 MB RAM (2 GB paging space)
2x PVR-250 capture cards (so all my recordings are MPEG-2 captured
from analog cable. Typically about 2.2GB per hour)
Slackware 13.0

Any suggestions are appreciated, though it might take me a couple of
days to find a window to try stuff...


More information about the mythtv-users mailing list