Bug 569347 - Pulseaudio uses 380 mb ram in /dev/shm
Summary: Pulseaudio uses 380 mb ram in /dev/shm
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: pulseaudio
Version: 12
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Lennart Poettering
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-03-01 11:25 UTC by TorkildJ
Modified: 2010-03-01 21:58 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-03-01 12:40:06 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description TorkildJ 2010-03-01 11:25:21 UTC
Description of problem:
This very unoptimal behaviour is observed on both F11,F12 (32+64bit).
On my netbook i had removd everything except libpulseaudio(for dependency reasons). Pulseaudio-client however still puts 2x64mb files in /dev/shm. A very wasteful thing to do on a netbook with a total of 2gb memory! 
I decided to test a bit futher: If pulseaudio server and client is installed it uses up to 380 mb in /dev/shm.
I am running my netbook  without use of any swap-space, and since /dev/shm is of type tmpfs, i cant see the used memory in system-monitor (its virtual memory). This explains why i have seen a tendency for applications to suddenlt crash, even though i still seem to have memory left. Turns out that its simply pulseaudio eating all my memory for no reason.

Problem is easyily solved:
in /etc/pulse/ i changed client.conf and daemon.conf to disable use of shm.

I agree performance is important. But using 380/2048 (19%) of system-memory for pulseaudio, when its not needed, is a  huge waste. I suggest use of shm is disabled as default for pulseaudio, or at least for pulseaudio-client. 

Version-Release number of selected component (if applicable):
All

How reproducible:
check /dev/shm

Steps to Reproduce:
1.
2.
3.
  
Actual results:
Using 380 mb of memory for pulseaudio in /dev/shm

Expected results:
Using less than 380 mb of memory for pulseaudio in /dev/shm

Additional info:

Comment 1 Lubomir Rintel 2010-03-01 12:40:06 UTC
Please note that anonymous memory mapped is not necessarily memory actually used.

Comment 2 TorkildJ 2010-03-01 13:09:07 UTC
Okay i was not aware of this. Is there any easy way to actually find  if the pulseaudio client is actually using the 2x64mb it has allocated in /dev/shm ?
And even if the memory is not actually used it prevents other programs from allocating memory in /dev/shm (even if its anonymous memory). Maybe its enough to change the following parameter in pulseaudio configuration:

shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB
to something like 5/10 mb . (of course depending on the actual pulseaudio usage of these files)

Comment 3 Lubomir Rintel 2010-03-01 13:25:00 UTC
(In reply to comment #2)
> Is there any easy way to actually find  if the
> pulseaudio client is actually using the 2x64mb it has allocated in /dev/shm ?

No idea. In file system it looks like the files have holes, which is what I suspect to be unallocated memory:

[lkundrak@trurl bear]$ du -sh /dev/shm/*
12K	/dev/shm/pulse-shm-3202944171
200K	/dev/shm/pulse-shm-3567843226
12K	/dev/shm/pulse-shm-607205414
76K	/dev/shm/pulse-shm-73718790
[lkundrak@trurl bear]$ du --apparent-size -sh /dev/shm/*
65M	/dev/shm/pulse-shm-3202944171
65M	/dev/shm/pulse-shm-3567843226
65M	/dev/shm/pulse-shm-607205414
65M	/dev/shm/pulse-shm-73718790
[lkundrak@trurl bear]$

Comment 4 Lennart Poettering 2010-03-01 21:35:24 UTC
Yes, Lubomir is right.

Those file sizes only reflect allocated address space, not actual memory. Use "du" to find out how much RAM this really uses.

Comment 5 TorkildJ 2010-03-01 21:58:03 UTC
I agree that this problem might not be a serious one. But for machines with low memory (and therefore less available memory in /dev/shm) there is a risk that pulseaudio will quickly allocate all available memory and make it impossible for other programs to use /dev/shm. It seems like pulseaudio uses 200kb/64mb, which might indicate that its a good idea to change the default configuration to limit pulseaudios shm use to 10mb per instance.. 10x3=30mb insteadt of 3x64=192mb allocated memory in /dev/shm. And also, why does pulseaudio client allocate 2x64 mb memory in /dev/shm despite the pulseaudio and alsa-plugin-pulseaudio package being uninstalled?!


Note You need to log in before you can comment on or make changes to this bug.