Opened 15 years ago

Closed 15 years ago

#6525 closed defect (fixed)

Memory Leaks (Valgrind Logs attached)

Reported by: bradley.kite@… Owned by: paulh
Priority: minor Milestone: 0.22
Component: MythTV - General Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

Hi there.

I recently upgraded to revision 20491 and started listening to my favorite radio show that I record each day.

After about 20 minutes my box ground to a halt.

I did some digging, and noticed memory growing a few megs each minute.

With a debug build and valgrind, I have produced 2 logs:

The first (valgrind-mythfrontend-20491M-start-and-quit.log) shows a small memory leak during initialisation - probably not significant. All I did was start mythfrontend and then quit again.

The second, more interesting log (valgrind-mythfrontend-20491M-radio-playback.log), is where I played back my radio show. It shows lots of leaks when dealing with MHI and OSD data. I only played around 20 seconds under valgrind, but it shows around 50MB leaked in total.

Am happy to do more testing etc. if required.

Attachments (2)

valgrind-mythfrontend-20491M-start-and-quit.log (52.0 KB) - added by bradley.kite@… 15 years ago.
start-and-quit.log
valgrind-mythfrontend-20491M-radio-playback.log (101.7 KB) - added by bradley.kite@… 15 years ago.
radio playback

Download all attachments as: .zip

Change History (7)

Changed 15 years ago by bradley.kite@…

start-and-quit.log

Changed 15 years ago by bradley.kite@…

radio playback

comment:1 Changed 15 years ago by paulh

The problem seems to be in OSDSet::Clear() for some reason Qt isn't deleting the OSD types after deleteLater() is called on them. The interative stuff is constantly clearing the OSD and recreating the OSD items again but because they never get deleted the memory usage grows rapidly.

comment:2 Changed 15 years ago by danielk

Version: unknownhead

In Qt4 deleteLater() is handled by the eventLoop() of the thread that where "new" was used to initially create the QObject. We are probably creating these objects in a thread which does not have a running Qt4 event loop. In Qt4, deleteLater() doesn't protect you from SLOT's being activated after a class is deleted anyway so the safest thing to do is probably to just remove all signals and slots from OSD objects, then remove the QObject inheritance and replace the deleteLater() with a simple delete.

comment:3 Changed 15 years ago by paulh

Milestone: unknown0.22
Owner: changed from Isaac Richards to paulh
Status: newassigned

comment:4 Changed 15 years ago by paulh

(In [20540]) Remove all the signals/slots in the OSD and use custom events instead. Refs #6525.

comment:5 Changed 15 years ago by paulh

Resolution: fixed
Status: assignedclosed

(In [20541]) Fix a bad memory leak in the interactive TV OSD.

Now that we don't have to worry about slots being called on OSD items after they have been deleted do the delete directly in OSDSet::Clear(). Fixes #6525.

Note: See TracTickets for help on using tickets.