Package: fluidsynth
Version: 2.3.1-2
Severity: normal
X-Debbugs-Cc: [email protected]

fluidsynth auto-starts on my system when I log in, and that causes it to
read into memory /usr/share/sounds/sf3/default-GM.sf3 (this is a symlink
to /etc/alternatives/default-GM.sf3 which is a symlink to
/usr/share/sounds/sf2/FluidR3_GM.sf2).

About 142 megabytes of it.

-rw-r--r-- 1 root root 142M Feb 24  2008 /usr/share/sounds/sf2/FluidR3_GM.sf2

This causes fluidsynth RSS to use about 165MB of residewnt memory, even
if it is not used for anything.

I do not know why it autostarts, my guess is that pipewire or something
else starts it, even if it is not needed. (it runs as a normal user, not
some system user, and there are no init.d script or systemd units for it
that I can find)

Memory usage, looks to correspond to this memory mapping.

Output of pmap -p $(pidof fluidsynth)

00007fdea2389000 144724K rw---   [ anon ]

But there is also many 8M mappings, but they do not contribute to RSS (mapped, 
but not touched).

If I show more info with pmap, I got:

3848:   /usr/bin/fluidsynth -is /usr/share/sounds/sf3/default-GM.sf3
     Address Perm   Offset Device  Inode    Size    Rss    Pss Pss_Dirty 
Referenced Anonymous LazyFree ShmemPmdMapped FilePmdMapped Shared_Hugetlb 
Private_Hugetlb Swap SwapPss Locked THPeligible Mapping
...
7fdea2389000 rw-p 00000000  00:00      0  144724 144724 144724    144724     
144724    144724        0              0             0              0           
    0    0       0 144724           1 
...


Not only it is fully read, it is mlock-ed (probably to ensure it is not
swapped out, which is important for audio application like this).


It would be desirable in situation like this, to not load whole sf file
by default (just read basic metadata of it), and delay loading, until
there is actually a need for it. Alternatively have them in a format on
disk, that can be mmaped directly. Proper behaviour could be controlled
by some command line flags.

Regards,
Witold

Reply via email to