Modify
Warning Please read the Ticket HowTo before creating or commenting on a ticket. Failure to do so may cause your ticket to be rejected or result in a slower response.

Opened 3 years ago

Closed 3 years ago

#9548 closed Patch - Bug Fix (Fixed)

[PATCH] pulseaudio output memory leaks

Reported by: b-mythtv@… Owned by: jyavenard
Priority: minor Milestone: unknown
Component: MythTV - General Version: 0.24-fixes
Severity: medium Keywords: pulseaudio
Cc: Ticket locked: yes

Description

The pulseaudio output of myth doesn't seem to clean up properly. Each stream consumes ~64MB of virtual address space due to shm segments with pulseaudio. After creating several streams, a 32-bit process is quickly exhausted of virtual address space, and a strings of these errors come from mythfrontend as further pa_context_new() calls fail.

mmap() failed: Cannot allocate memory
mmap() failed: Cannot allocate memory
mmap() failed: Cannot allocate memory
mmap() failed: Cannot allocate memory
...
2011-02-04 09:38:11.185 PulseAudio? Error: ContextConnect?, failed to acquire new context

You can also observe the issue by looking at mythfrontend.real's VSS size after opening and closing a stream. With this bug, it increases by 64MB each time a new stream is created (either live tv, or viewing a video).

It seems that the pa_contexts are not being freed in audiooutputpulse.cpp. The attached patch unref's them at various points, and fixes the memory leaks for me (VSS no longer creeps up, and the mmap() problems are gone). I can't claim to understand the code well enough to know if this is correct though.

Attachments (2)

pa-mem-leak.diff (1.4 KB) - added by b-mythtv@… 3 years ago.
possible patch for the memory leak
pa-mem-leak-fixed.diff (966 bytes) - added by b-mythtv@… 3 years ago.
Fixes the bug (without the spurious hunk)

Download all attachments as: .zip

Change History (9)

Changed 3 years ago by b-mythtv@…

possible patch for the memory leak

comment:1 Changed 3 years ago by b-mythtv@…

I forgot to mention - once the mmap() errors occur, no audio comes from MythTV until the frontend is restarted. This is the same problem reported here: http://mythtv.org/pipermail/mythtv-users/2010-November/302051.html

comment:2 Changed 3 years ago by beirdo

  • Owner set to jyavenard
  • Status changed from new to assigned

Changed 3 years ago by b-mythtv@…

Fixes the bug (without the spurious hunk)

comment:3 Changed 3 years ago by mythtv@…

"Me too". Been wondering what caused my Myth to have no sound after a few start/stop cycles. On my system I'd swear the leak was 150-200MB each time though, not 64MB. My 8GB RAM gets used up very fast. Like the reporter, there is no sound until myth is quit and restarted. Same error output seen here, too.

comment:4 Changed 3 years ago by wagnerrp

  • Ticket locked set

comment:5 Changed 3 years ago by beirdo

  • Summary changed from pulseaudio output memory leaks to [PATCH] pulseaudio output memory leaks

comment:6 Changed 3 years ago by jyavenard

Last edited 3 years ago by jyavenard (previous) (diff)

comment:7 Changed 3 years ago by jyavenard

  • Resolution set to Fixed
  • Status changed from assigned to closed

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'new'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.