如何确定哪个进程导致高内存消耗?

如何确定哪个进程导致高内存消耗?

我正在运行虚拟化的 Arch Linux 机器。

有时,它显示内存消耗很高,我不知道原因,因为基本上,机器处于闲置状态。

在此输入图像描述

# ps aux --sort=-%mem | awk 'NR<=10{print $0}'
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
mysql    2126635  0.0  1.2 646276 101188 ?       Ssl  11:46   0:00 /usr/bin/mariadbd
root     2126593  0.2  0.4 1724176 39152 ?       Ssl  11:46   0:00 /usr/bin/containerd
root           1  0.0  0.1  29268 14708 ?        Ss    2023  58:46 /usr/lib/systemd/systemd --system --deserialize 74
root     2126601  0.0  0.1  25140 11180 ?        Ss   11:46   0:00 /usr/lib/systemd/systemd-journald
root     2126182  0.1  0.0 235812  7720 ?        Ssl  11:33   0:01 /usr/bin/vmtoolsd
root     2126651  0.0  0.0  11224  4344 pts/1    R+   11:51   0:00 ps aux --sort=-%mem
root         268  0.0  0.0  33176  2792 ?        Ss    2023   3:09 /usr/lib/systemd/systemd-udevd
root     2123091  0.0  0.0   7892  2688 pts/1    Ss   11:05   0:00 -bash
dhcpcd       344  0.0  0.0  23232  1760 ?        S     2023   3:15 dhcpcd: [manager] [ip4] [ip6]

杀掉之后玛丽亚数据库容器d流程我得到以下信息:

![在此输入图像描述

# ps aux --sort=-%mem
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root     2126816  1.0  0.6 2655100 53764 ?       Ssl  12:13   2:44 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
root     2126786  0.0  0.2 1945884 23332 ?       Ssl  12:05   0:10 /usr/bin/containerd
mysql    2126768  1.8  0.2 659516 17500 ?        Ssl  12:05   4:57 /usr/bin/mariadbd
root           1  0.0  0.1  29268 10020 ?        Ss    2023  58:48 /usr/lib/systemd/systemd --system --deserialize 74
root     2126601  0.0  0.1  33428  9828 ?        Ss   11:46   0:00 /usr/lib/systemd/systemd-journald
root     2160091  0.1  0.1  12952  8988 ?        Ss   16:33   0:00 sshd: root@pts/0
root     2126182  0.1  0.0 310920  5708 ?        Ssl  11:33   0:18 /usr/bin/vmtoolsd
root     2160093  0.0  0.0   7908  4680 pts/0    Ss   16:33   0:00 -bash
root     2160287  0.0  0.0  11224  4360 pts/0    R+   16:35   0:00 ps aux --sort=-%mem
root         268  0.0  0.0  33176  3524 ?        Ss    2023   3:10 /usr/lib/systemd/systemd-udevd
dbus         338  0.0  0.0   9132  1612 ?        Ss    2023   7:58 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
root         345  0.0  0.0   3372  1584 ?        S     2023   1:50 dhcpcd: [privileged proxy]
dhcpcd       344  0.0  0.0  23232  1564 ?        S     2023   3:15 dhcpcd: [manager] [ip4] [ip6]
root         375  0.0  0.0  11080  1548 ?        Ss    2023   0:00 sshd: /usr/bin/sshd -D [listener] 0 of 10-100 startups
root         340  0.0  0.0  25988  1180 ?        Ss    2023   2:02 /usr/lib/systemd/systemd-logind
dhcpcd       347  0.0  0.0   3004   104 ?        S     2023   0:00 dhcpcd: [control proxy]
dhcpcd       346  0.0  0.0   3012    84 ?        S     2023   0:00 dhcpcd: [network proxy]
root           2  0.0  0.0      0     0 ?        S     2023   0:05 [kthreadd]
root           3  0.0  0.0      0     0 ?        I<    2023   0:00 [rcu_gp]
root           4  0.0  0.0      0     0 ?        I<    2023   0:00 [rcu_par_gp]
root           5  0.0  0.0      0     0 ?        I<    2023   0:00 [slub_flushwq]
root           6  0.0  0.0      0     0 ?        I<    2023   0:00 [netns]
root           8  0.0  0.0      0     0 ?        I<    2023   0:00 [kworker/0:0H-events_highpri]
root          10  0.0  0.0      0     0 ?        I<    2023   0:00 [mm_percpu_wq]
root          12  0.0  0.0      0     0 ?        I     2023   0:00 [rcu_tasks_kthread]
root          13  0.0  0.0      0     0 ?        I     2023   0:00 [rcu_tasks_rude_kthread]
root          14  0.0  0.0      0     0 ?        I     2023   0:00 [rcu_tasks_trace_kthread]
root          15  0.0  0.0      0     0 ?        S     2023 110:50 [ksoftirqd/0]
root          16  0.0  0.0      0     0 ?        I     2023  75:52 [rcu_preempt]
root          17  0.0  0.0      0     0 ?        S     2023   0:06 [rcub/1]
root          18  0.0  0.0      0     0 ?        S     2023   0:28 [migration/0]
root          19  0.0  0.0      0     0 ?        S     2023   0:00 [idle_inject/0]
root          21  0.0  0.0      0     0 ?        S     2023   0:00 [cpuhp/0]
root          22  0.0  0.0      0     0 ?        S     2023   0:00 [cpuhp/1]
root          23  0.0  0.0      0     0 ?        S     2023   0:00 [idle_inject/1]
root          24  0.0  0.0      0     0 ?        S     2023   0:29 [migration/1]
root          25  0.0  0.0      0     0 ?        S     2023 101:42 [ksoftirqd/1]
root          28  0.0  0.0      0     0 ?        S     2023   0:00 [kdevtmpfs]
root          29  0.0  0.0      0     0 ?        I<    2023   0:00 [inet_frag_wq]
root          30  0.0  0.0      0     0 ?        S     2023   0:35 [kauditd]
root          32  0.0  0.0      0     0 ?        S     2023   0:10 [khungtaskd]
root          34  0.0  0.0      0     0 ?        S     2023   0:00 [oom_reaper]
root          35  0.0  0.0      0     0 ?        I<    2023   0:03 [writeback]
root          36  0.2  0.0      0     0 ?        S     2023 588:57 [kcompactd0]
root          37  0.0  0.0      0     0 ?        SN    2023   0:00 [ksmd]
root          38  0.0  0.0      0     0 ?        SN    2023  28:35 [khugepaged]
root          39  0.0  0.0      0     0 ?        I<    2023   0:00 [kintegrityd]
root          40  0.0  0.0      0     0 ?        I<    2023   0:00 [kblockd]
root          41  0.0  0.0      0     0 ?        I<    2023   0:00 [blkcg_punt_bio]
root          42  0.0  0.0      0     0 ?        I<    2023   0:00 [tpm_dev_wq]
root          43  0.0  0.0      0     0 ?        I<    2023   0:00 [ata_sff]
root          44  0.0  0.0      0     0 ?        I<    2023   0:00 [edac-poller]
root          45  0.0  0.0      0     0 ?        I<    2023   0:00 [devfreq_wq]
root          46  0.0  0.0      0     0 ?        S     2023   0:00 [watchdogd]
root          48  0.2  0.0      0     0 ?        I<    2023 507:29 [kworker/0:1H-kblockd]
root          49  0.1  0.0      0     0 ?        S     2023 361:25 [kswapd0]
root          56  0.0  0.0      0     0 ?        I<    2023   0:00 [kthrotld]
root          61  0.0  0.0      0     0 ?        S     2023   0:00 [irq/24-pciehp]
root          62  0.0  0.0      0     0 ?        S     2023   0:00 [irq/25-pciehp]
root          63  0.0  0.0      0     0 ?        S     2023   0:00 [irq/26-pciehp]
root          64  0.0  0.0      0     0 ?        S     2023   0:00 [irq/27-pciehp]
root          65  0.0  0.0      0     0 ?        S     2023   0:00 [irq/28-pciehp]
root          66  0.0  0.0      0     0 ?        S     2023   0:00 [irq/29-pciehp]
root          67  0.0  0.0      0     0 ?        S     2023   0:00 [irq/30-pciehp]
root          68  0.0  0.0      0     0 ?        S     2023   0:00 [irq/31-pciehp]
root          69  0.0  0.0      0     0 ?        S     2023   0:00 [irq/32-pciehp]
root          70  0.0  0.0      0     0 ?        S     2023   0:00 [irq/33-pciehp]
root          71  0.0  0.0      0     0 ?        S     2023   0:00 [irq/34-pciehp]
root          72  0.0  0.0      0     0 ?        S     2023   0:00 [irq/35-pciehp]
root          73  0.0  0.0      0     0 ?        S     2023   0:00 [irq/36-pciehp]
root          74  0.0  0.0      0     0 ?        S     2023   0:00 [irq/37-pciehp]
root          75  0.0  0.0      0     0 ?        S     2023   0:00 [irq/38-pciehp]
root          76  0.0  0.0      0     0 ?        S     2023   0:00 [irq/39-pciehp]
root          77  0.0  0.0      0     0 ?        S     2023   0:00 [irq/40-pciehp]
root          78  0.0  0.0      0     0 ?        S     2023   0:00 [irq/41-pciehp]
root          79  0.0  0.0      0     0 ?        S     2023   0:00 [irq/42-pciehp]
root          80  0.0  0.0      0     0 ?        S     2023   0:00 [irq/43-pciehp]
root          81  0.0  0.0      0     0 ?        S     2023   0:00 [irq/44-pciehp]
root          82  0.0  0.0      0     0 ?        S     2023   0:00 [irq/45-pciehp]
root          83  0.0  0.0      0     0 ?        S     2023   0:00 [irq/46-pciehp]
root          84  0.0  0.0      0     0 ?        S     2023   0:00 [irq/47-pciehp]
root          85  0.0  0.0      0     0 ?        S     2023   0:00 [irq/48-pciehp]
root          86  0.0  0.0      0     0 ?        S     2023   0:00 [irq/49-pciehp]
root          87  0.0  0.0      0     0 ?        S     2023   0:00 [irq/50-pciehp]
root          88  0.0  0.0      0     0 ?        S     2023   0:00 [irq/51-pciehp]
root          89  0.0  0.0      0     0 ?        S     2023   0:00 [irq/52-pciehp]
root          90  0.0  0.0      0     0 ?        S     2023   0:00 [irq/53-pciehp]
root          91  0.0  0.0      0     0 ?        S     2023   0:00 [irq/54-pciehp]
root          92  0.0  0.0      0     0 ?        S     2023   0:00 [irq/55-pciehp]
root          93  0.0  0.0      0     0 ?        I<    2023   0:00 [acpi_thermal_pm]
root          94  0.0  0.0      0     0 ?        S     2023   0:00 [xenbus_probe]
root          95  0.0  0.0      0     0 ?        I<    2023   0:00 [mld]
root          96  0.2  0.0      0     0 ?        I<    2023 596:30 [kworker/1:1H-kblockd]
root          97  0.0  0.0      0     0 ?        I<    2023   0:00 [ipv6_addrconf]
root         102  0.0  0.0      0     0 ?        I<    2023   0:00 [kstrp]
root         106  0.0  0.0      0     0 ?        I<    2023   0:00 [zswap1]
root         107  0.0  0.0      0     0 ?        I<    2023   0:00 [zswap1]
root         108  0.0  0.0      0     0 ?        I<    2023   0:00 [zswap-shrink]
root         109  0.0  0.0      0     0 ?        I<    2023   0:00 [kworker/u129:0]
root         148  0.0  0.0      0     0 ?        I<    2023   0:00 [charger_manager]
root         181  0.0  0.0      0     0 ?        S     2023   0:00 [scsi_eh_0]
root         182  0.0  0.0      0     0 ?        I<    2023   0:00 [scsi_tmf_0]
root         183  0.0  0.0      0     0 ?        S     2023   0:00 [scsi_eh_1]
root         184  0.0  0.0      0     0 ?        I<    2023   0:00 [scsi_tmf_1]
root         185  0.0  0.0      0     0 ?        I<    2023   0:00 [cryptd]
root         217  0.0  0.0      0     0 ?        S     2023  12:41 [jbd2/sda2-8]
root         218  0.0  0.0      0     0 ?        I<    2023   0:00 [ext4-rsv-conver]
root         303  0.0  0.0      0     0 ?        S     2023   0:00 [jbd2/sda3-8]
root         304  0.0  0.0      0     0 ?        I<    2023   0:00 [ext4-rsv-conver]
root         317  0.0  0.0      0     0 ?        S     2023   5:50 [irq/16-vmwgfx]
root         318  0.0  0.0      0     0 ?        S     2023   0:00 [card0-crtc0]
root         319  0.0  0.0      0     0 ?        S     2023   0:00 [card0-crtc1]
root         320  0.0  0.0      0     0 ?        S     2023   0:00 [card0-crtc2]
root         321  0.0  0.0      0     0 ?        S     2023   0:00 [card0-crtc3]
root         322  0.0  0.0      0     0 ?        S     2023   0:00 [card0-crtc4]
root         323  0.0  0.0      0     0 ?        S     2023   0:00 [card0-crtc5]
root         324  0.0  0.0      0     0 ?        S     2023   0:00 [card0-crtc6]
root         325  0.0  0.0      0     0 ?        S     2023   0:00 [card0-crtc7]
root         333  0.0  0.0      0     0 ?        I<    2023   0:00 [nfit]
root         365  0.0  0.0      0     0 ?        I<    2023   0:00 [cfg80211]
root         378  0.0  0.0   5988     0 tty1     Ss+   2023   0:00 /sbin/agetty -o -p -- \u --noclear - linux
dhcpcd       379  0.0  0.0   3372     0 ?        S     2023   0:00 dhcpcd: [BPF ARP] ens192 X.X.X.X
root         510  0.0  0.0      0     0 ?        I<    2023   0:00 [dio/sda2]
root        2524  0.0  0.0      0     0 ?        I<    2023   0:00 [tls-strp]
root     1938527  0.5  0.0      0     0 ?        I<   ene17   6:21 [kworker/1:2H-kblockd]
root     2124077  0.0  0.0      0     0 ?        S    11:14   0:00 [psimon]
root     2126602  0.0  0.0      0     0 ?        S    11:46   0:00 [psimon]
root     2127706  0.0  0.0      0     0 ?        I    12:15   0:06 [kworker/0:4-events]
root     2132781  0.0  0.0      0     0 ?        I    12:35   0:01 [kworker/u128:0-events_unbound]
root     2146784  0.0  0.0      0     0 ?        I    14:08   0:04 [kworker/1:2-rcu_par_gp]
root     2155973  0.0  0.0      0     0 ?        I    15:49   0:01 [kworker/0:0-rcu_par_gp]
root     2155990  0.0  0.0      0     0 ?        I    15:49   0:00 [kworker/1:1-rcu_par_gp]
root     2157900  0.0  0.0      0     0 ?        I    16:07   0:00 [kworker/u128:2-events_power_efficient]
root     2158776  0.0  0.0      0     0 ?        I    16:18   0:00 [kworker/u128:3-zswap1]
root     2160112  0.0  0.0      0     0 ?        I    16:34   0:00 [kworker/0:1-rcu_par_gp]
root     2160115  0.0  0.0      0     0 ?        I    16:34   0:00 [kworker/0:2]
root     2160116  0.0  0.0      0     0 ?        I    16:34   0:00 [kworker/u128:1-events_unbound]
root     2160117  0.0  0.0      0     0 ?        I    16:34   0:00 [kworker/u128:4-writeback]
root     2160151  0.0  0.0      0     0 ?        I    16:34   0:00 [kworker/1:0-rcu_gp]
root     2160195  0.0  0.0      0     0 ?        I    16:34   0:00 [kworker/1:3-events]

自由的输出:

# free -m

               total       usado       libre  compartido   búf/caché  disponible
Mem:            7931        6278        1183           0         768        1653
Inter:         20479         481       19998

# free -g
               total       usado       libre  compartido   búf/caché  disponible
Mem:               7           6           1           0           0           1
Inter:            19           0          19

有什么方法可以释放这块内存吗?

预先感谢您的回答。

相关内容