How do I stop Pulseaudio using huge amounts of memory?
Solution 1:
Are you sure that this is real memory consumption and not virtual-only? According to https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/MemoryConsumption/, it reserves 64 MB per client on virtual memory, but that should actually be "fine" and not result in OOM situations. On my 18.04 ubuntu, top shows e.g.
%Cpu(s): 4,1 us, 1,5 sy, 0,0 ni, 93,2 id, 1,1 wa, 0,0 hi, 0,0 si, 0,0 st
KiB Mem : 16135328 total, 1088888 free, 8108764 used, 6937676 buff/cache
KiB Swap: 1003516 total, 961276 free, 42240 used. 6562996 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
[...]
20428 delf 9 -11 2464944 13808 10264 S 4,6 0,1 3:05.72 pulseaudio
So ~2,5 gig on virtual memory, while actually %-memory consumed measured with ps shows:
% ps -o pid,%mem,command ax | grep pulseaudio
1811 0.0 /usr/bin/pulseaudio --daemonize=no
7363 0.0 grep pulseaudio
20428 0.0 /usr/bin/pulseaudio --start --log-target=syslog
So maybe everything is just fine..? :)