Fix pulseaudio Memory Leak

Wainaina Gichuhi
2 min readMay 14, 2023

--

Have you ever opened your system monitor and found pulseaudio is utilizing huge amounts of RAM (physical memory), sometimes as much as 18% of the total physical memory.

High memory usage
High memory usage. Source https://www.middlewareinventory.com/wp-content/uploads/2022/01/kube-node-disk-usage.png

Unless you have explicitly allowed for such usage, even 100 megabytes (MB) of RAM is a lot for pulseaudio.

Now, I understand that pulseaudio can consume large amounts of virtual memory. If you need to reduce the virtual memory usage from pulseaudio, check out his forum:

However, if you have counterchecked your memory consumption and determined the high usage is on physical memory and not virtual memory, there is a solution.

I encountered high memory usage when playing audio from an android phone through a laptop using bluetooth on Wayland GNOME 43.

The solution that worked for me was disabling PulseAudio’s timer-based
scheduling by adding tsched=0 to the end of the load-module module-udev-detect line in /etc/pulse/default.pa.

load-module module-udev-detect line
load-module module-udev-detect line

Another solution (I have not tested this) is to reduce the number of channels that PulseAudio uses. You can do this by editing the /etc/pulse/daemon.conf file and changing the default-
fragments
and default-fragment-size-msec values.

default- fragments and default-fragment-size-msec values
default-
fragments
and default-fragment-size-msec values

Hope this helps!

Want to set a default output device on boot without the need to select one each time? Check out this tutorial.

--

--