Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#10630 closed Bug Report - General (Fixed)

Memory leak when subtitles are "on"

Reported by: Mossy <nosepam-mythtv@…> Owned by: Jim Stichnoth
Priority: minor Milestone: 0.25.1
Component: MythTV - Captions Version: 0.25-fixes
Severity: medium Keywords: subtitles memory leak
Cc: Ticket locked: no

Description

Most of the channels that I get ignore the "Subtitles Font" setting (which is fine by me). However, I get memory leaks on the channels that do use the "Subtitles Font", specified on the "Playback OSD" screen, when the subtitles are on.

The memory used by the FE increases until the FE becomes unusable. On some programmes this can happen in less than an hour on a machine with 4GB of ram. Happens with both LiveTV and Recordings. Stopping playback (i.e. going back to the main menu) does not free up the memory.

Also seen in 0.24.

To reproduce:

  1. Watch a channel that sets the subtitle font according to the setting on the "Playback OSD" page (or watch a recording made on such a channel).
  2. Turn the subtitles on, if they are not already on.
  3. Observe the FE memory usage (e.g. "top")

Expected results: FE memory usage does not increase significantly while the programme is being watched/played back.

Actual Results: FE memory usage increases proportionally to the amount of subtitles shown on screen until all available memory is used up. Stopping playback back does not free up memory.

Attachments (4)

version.txt (730 bytes) - added by Mossy <nosepam-mythtv@…> 12 years ago.
version
mythfrontend.log (11.8 KB) - added by Mossy <nosepam-mythtv@…> 12 years ago.
FE log
vglog.log.zip (462.2 KB) - added by Mossy <nosepam-mythtv@…> 12 years ago.
valgrind log
10630.patch (671 bytes) - added by Mossy <nosepam-mythtv@…> 12 years ago.
Patch. Based on 0.25-fixes.

Download all attachments as: .zip

Change History (11)

Changed 12 years ago by Mossy <nosepam-mythtv@…>

Attachment: version.txt added

version

Changed 12 years ago by Mossy <nosepam-mythtv@…>

Attachment: mythfrontend.log added

FE log

Changed 12 years ago by Mossy <nosepam-mythtv@…>

Attachment: vglog.log.zip added

valgrind log

comment:1 Changed 12 years ago by Mossy <nosepam-mythtv@…>

FE launched like this:

valgrind --log-file=/home/mossy/log/vglog.log --leak-check=full --error-limit=no --show-reachable=yes /usr/bin/mythfrontend -O UIPainter=qt

I played a 40 minute recording, subtitles "on", then let the FE idle for about 9 hours before shutting it down again.

comment:2 Changed 12 years ago by Mossy <nosepam-mythtv@…>

In case it helps this is a short recording from one of the relevant channels (5 mins, 100MB):

http://dl.dropbox.com/u/74461807/3001_20120419112034.mpg

comment:3 Changed 12 years ago by Jim Stichnoth

Milestone: unknown0.26
Status: newaccepted

I'm surprised at the memory leak, as it appears that the teletextscreen.cpp code is correctly cleaning up after itself, yet I see the mythfrontend memory size grow as I play the sample several times.

I am planning to refactor the teletextscreen.cpp and subtitlescreen.cpp into a common code base, and I expect that will fix the leak.

Changed 12 years ago by Mossy <nosepam-mythtv@…>

Attachment: 10630.patch added

Patch. Based on 0.25-fixes.

comment:4 Changed 12 years ago by Mossy <nosepam-mythtv@…>

The memory leak was from objects that are stored in teletextscreen.cpp in a hash.

TeletextScreen::ClearScreen?() processed the hash as if it were a list, resulting in few, if any, of the objects being deleted.

The patch above fixes this.

I should have spotted the problem when I first looked at the code, your comment prompted me to look again.

comment:5 Changed 12 years ago by stuartm

Hah! You spotted this at exactly the same time I did, I was about to commit the fix.

comment:6 Changed 12 years ago by stuartm

Milestone: 0.260.25.1
Resolution: Fixed
Status: acceptedclosed

[master dc63336] Fix leak in TeletextScreen::ClearScreen?. Fixes #10630

comment:7 Changed 12 years ago by stuartm

[fixes/0.25 c171fe9] Fix leak in TeletextScreen::ClearScreen?. Fixes #10630 (cherry picked from commit d5b6760f1cf3a6eb031c96a7b340fbcbd1bb2358)

Note: See TracTickets for help on using tickets.