是什么占用了我的空闲内存?

tha*_*ott -1 memory-usage 22.04

我有计算机为我们的社区广播电台处理各种功能,包括处理广播节目音频。它远程运行并每天发送健康电子邮件,以便我关注其状态。我发现空闲内存在几天内下降了很多,并且无法解释它的去向。

该报告包含“free”的输出以及使用内存的前 20 个进程:

ps -eo comm:15,pid,ppid,cmd,%mem,%cpu --sort=-%mem | head -n 20
Run Code Online (Sandbox Code Playgroud)

两天前:

Memory stats as of 10/17/2023
               total        used        free      shared  buff/cache   available
Mem:            12Gi       3.1Gi       7.4Gi       160Mi       2.1Gi       9.0Gi
Swap:             0B          0B          0B
Total:          12Gi       3.1Gi       7.4Gi
 
MEM stats
COMMAND             PID    PPID CMD                         %MEM %CPU
ST_FM              2214       1 /home/kpov_tech/Desktop/Ste  4.6 24.1
ST_Stream          2256       1 /home/kpov_tech/Desktop/Ste  4.5 21.6
plasmashell        1759    1689 /usr/bin/plasmashell         2.0  0.2
kwin_x11           1721    1689 /usr/bin/kwin_x11            1.8 10.7
fluidsynth         1538    1528 /usr/bin/fluidsynth -is /us  1.8  0.0
kded5              1718    1689 /usr/bin/kded5               1.8  0.0
audacious        871581  827042 /usr/bin/audacious --play    1.6  1.6
Xorg               1259    1218 /usr/lib/xorg/Xorg -noliste  1.3 16.8
dolphin          774584    1759 /usr/bin/dolphin             1.2  0.1
kwrite            44322       1 /usr/bin/kwrite /home/kpov_  1.1  0.1
konsole            2097       1 konsole --noclose --profile  1.0  0.1
raysession         2307       1 /usr/bin/python3 -u /usr/sh  1.0  0.3
jackd              2111    2097 /usr/bin/jackd -v -d alsa -  1.0  0.7
zita-mu1           2173       1 /usr/bin/zita-mu1 -name MON  0.9  0.4
ebumeter           2191       1 ebumeter -name ebu_Raw_MCR   0.9  1.0
ebumeter           2207       1 ebumeter -name ebu_ListenLi  0.9  0.9
ebumeter           2200       1 ebumeter -name ebu_ST_FM     0.9  0.9
ebumeter           2184       1 ebumeter -name ebu_ST_Strea  0.9  0.9
ray-jackpatch_t    2330       1 /usr/bin/python3 -u /usr/sh  0.9  0.1
Run Code Online (Sandbox Code Playgroud)

今天:

Memory stats as of 10/19/2023
               total        used        free      shared  buff/cache   available
Mem:            12Gi       3.8Gi       529Mi       155Mi       8.2Gi       8.2Gi
Swap:             0B          0B          0B
Total:          12Gi       3.8Gi       529Mi

MEM stats
COMMAND             PID    PPID CMD                         %MEM %CPU
ST_FM              2214       1 /home/kpov_tech/Desktop/Ste  4.6 24.1
ST_Stream          2256       1 /home/kpov_tech/Desktop/Ste  4.5 21.8
plasmashell        1759    1689 /usr/bin/plasmashell         2.4  0.2
fluidsynth         1538    1528 /usr/bin/fluidsynth -is /us  1.8  0.0
kwin_x11           1721    1689 /usr/bin/kwin_x11            1.8  9.5
audacious        871581  827042 /usr/bin/audacious --play    1.5  1.6
Xorg               1259    1218 /usr/lib/xorg/Xorg -noliste  1.2 16.4
dolphin         3467064    1759 /usr/bin/dolphin             1.1  0.1
kwrite            44322       1 /usr/bin/kwrite /home/kpov_  1.0  0.1
kded5              1718    1689 /usr/bin/kded5               1.0  0.0
jackd              2111    2097 /usr/bin/jackd -v -d alsa -  1.0  0.7
konsole            2097       1 konsole --noclose --profile  1.0  0.0
raysession         2307       1 /usr/bin/python3 -u /usr/sh  1.0  0.3
xdg-desktop-por 3450540    1528 /usr/lib/x86_64-linux-gnu/l  0.9  0.0
zita-mu1           2173       1 /usr/bin/zita-mu1 -name MON  0.9  0.4
ebumeter           2191       1 ebumeter -name ebu_Raw_MCR   0.9  1.0
ebumeter           2207       1 ebumeter -name ebu_ListenLi  0.9  0.9
ebumeter           2200       1 ebumeter -name ebu_ST_FM     0.9  0.9
ebumeter           2184       1 ebumeter -name ebu_ST_Strea  0.9  0.9
Run Code Online (Sandbox Code Playgroud)

在我看来,7Gi 的可用内存已经消失了。我怎样才能知道什么在使用它?

小智 6

从“免费”应用程序的输出可以看出,您有大约 8-9Gi 的可用内存。

您可能会感到困惑的是,在标有“空闲”的列下,您会看到非常少量的内存 - 这是正常行为。

您必须将“buff/cache”列下的可用内存量考虑在内- Linux 使用可用内存作为缓冲区来帮助加速其他进程(如果可能),并且该内存在传统意义上并不是不可用的 - 您仍然可以使用它如果需要,可用于其他应用程序。

您可以查看日志中“可用”列下列出的系统上的总可用内存。