SHMem 内存使用率过高!

SHMem 内存使用率过高!

我已经尝试了所有能想到的方法,所以我在这里问这个问题......

我有一台 8 GB 内存的电脑。在启动电脑、登录、不打开任何应用程序并让电脑通宵运行后,内存使用率飙升,所有 8 GB 的内存都被用完了。起初我怀疑这只是一个缓存问题,但又过了 5 个小时,1.2 GB 的交换空间被占用(没有打开任何应用程序)。

为了进一步反驳可能是缓存或内存泄漏应用程序的事实,以下是输出free -m

              total        used        free      shared  buff/cache   available
Mem:           7871        1948        1358        3583        4564        2251
Swap:         17163        1225       15938

这份报告是在我重启后写这个问题时拍摄的,所以情况没有那么糟糕。你可以看到,我只有大约 1 GB 的可用内存,而缓存内存几乎5 GB

从 Ubuntu Gnome 15.10 升级到 Ubuntu Gnome 16.04 后开始出现这种情况。

以下是输出cat /proc/meminfo

MemTotal:        8060844 kB
MemFree:         1285532 kB
MemAvailable:    2221384 kB
Buffers:          103160 kB
Cached:          4545380 kB
SwapCached:         4764 kB
Active:          2408216 kB
Inactive:        4101492 kB
Active(anon):    1879072 kB
Inactive(anon):  3737296 kB
Active(file):     529144 kB
Inactive(file):   364196 kB
Unevictable:        4928 kB
Mlocked:            4928 kB
SwapTotal:      17575932 kB
SwapFree:       16320824 kB
Dirty:              1844 kB
Writeback:             0 kB
AnonPages:       1861356 kB
Mapped:           552908 kB
Shmem:           3751656 kB
Slab:             129324 kB
SReclaimable:      84788 kB
SUnreclaim:        44536 kB
KernelStack:       13856 kB
PageTables:        51188 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:    21606352 kB
Committed_AS:   13184460 kB
VmallocTotal:   34359738367 kB
VmallocUsed:           0 kB
VmallocChunk:          0 kB
HardwareCorrupted:     0 kB
AnonHugePages:    393216 kB
CmaTotal:              0 kB
CmaFree:               0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:      195328 kB
DirectMap2M:     8079360 kB
DirectMap1G:     1048576 kB

以下是该程序的输出ps_mem

 Private  +   Shared  =  RAM used   Program

 92.0 KiB +  16.5 KiB = 108.5 KiB   xf86-video-intel-backlight-helper
120.0 KiB +  28.0 KiB = 148.0 KiB   sleep
160.0 KiB +  33.5 KiB = 193.5 KiB   agetty
164.0 KiB +  34.5 KiB = 198.5 KiB   gnome-pty-helper
244.0 KiB +  22.0 KiB = 266.0 KiB   acpid
252.0 KiB +  40.5 KiB = 292.5 KiB   uuidd
192.0 KiB + 103.0 KiB = 295.0 KiB   cat (2)
284.0 KiB +  32.5 KiB = 316.5 KiB   irqbalance
284.0 KiB +  64.5 KiB = 348.5 KiB   syndaemon
328.0 KiB +  44.5 KiB = 372.5 KiB   cron
372.0 KiB +  78.0 KiB = 450.0 KiB   upstart-udev-bridge
400.0 KiB +  65.0 KiB = 465.0 KiB   rtkit-daemon
432.0 KiB +  58.0 KiB = 490.0 KiB   systemd-timesyncd
520.0 KiB +  80.0 KiB = 600.0 KiB   upstart-file-bridge
608.0 KiB +  77.0 KiB = 685.0 KiB   gpg-agent
728.0 KiB +  87.5 KiB = 815.5 KiB   sshd
744.0 KiB + 134.0 KiB = 878.0 KiB   gvfs-goa-volume-monitor
880.0 KiB +  31.0 KiB = 911.0 KiB   dhclient
680.0 KiB + 241.0 KiB = 921.0 KiB   upstart-dbus-bridge (2)
784.0 KiB + 181.0 KiB = 965.0 KiB   gvfsd
888.0 KiB +  99.0 KiB = 987.0 KiB   gvfsd-metadata
672.0 KiB + 335.0 KiB =   1.0 MiB   avahi-daemon (2)
952.0 KiB +  62.5 KiB =   1.0 MiB   systemd-logind
820.0 KiB + 195.0 KiB =   1.0 MiB   gvfsd-burn
920.0 KiB +  99.5 KiB =   1.0 MiB   thermald
996.0 KiB + 106.0 KiB =   1.1 MiB   gvfsd-fuse
  1.0 MiB +  36.0 KiB =   1.1 MiB   wallpaper-chang
  1.0 MiB + 133.0 KiB =   1.1 MiB   gvfs-gphoto2-volume-monitor
  1.0 MiB +  77.0 KiB =   1.1 MiB   dconf-service
968.0 KiB + 214.5 KiB =   1.2 MiB   gvfsd-trash
972.0 KiB + 237.0 KiB =   1.2 MiB   sudo
  1.2 MiB +  58.0 KiB =   1.2 MiB   bluetoothd
  1.1 MiB + 171.0 KiB =   1.3 MiB   gdm-x-session (2)
  1.2 MiB + 113.5 KiB =   1.3 MiB   upstart
888.0 KiB + 468.0 KiB =   1.3 MiB   dnsmasq (2)
  1.2 MiB + 207.0 KiB =   1.4 MiB   ibus-engine-simple (2)
  1.4 MiB +  59.5 KiB =   1.5 MiB   rsyslogd
  1.3 MiB + 233.0 KiB =   1.5 MiB   ibus-dconf (2)
  1.4 MiB + 156.0 KiB =   1.5 MiB   gdm3
  1.4 MiB + 189.0 KiB =   1.6 MiB   deja-dup-monitor
  1.3 MiB + 329.0 KiB =   1.7 MiB   at-spi2-registryd (2)
  1.6 MiB + 223.5 KiB =   1.8 MiB   goa-identity-service
  1.7 MiB + 188.0 KiB =   1.9 MiB   atop
  1.8 MiB +  89.0 KiB =   1.9 MiB   systemd-udevd
  1.5 MiB + 462.0 KiB =   1.9 MiB   gconf-helper (2)
  1.8 MiB + 147.5 KiB =   1.9 MiB   upowerd
  1.7 MiB + 281.0 KiB =   2.0 MiB   gconfd-2 (2)
  1.8 MiB + 151.0 KiB =   2.0 MiB   ModemManager
  2.0 MiB +  84.0 KiB =   2.1 MiB   wpa_supplicant
  1.7 MiB + 323.0 KiB =   2.1 MiB   gvfs-udisks2-volume-monitor
  1.8 MiB + 322.0 KiB =   2.1 MiB   ibus-engine-pinyin
  1.4 MiB + 780.5 KiB =   2.2 MiB   telepathy-logger
  2.3 MiB +  41.5 KiB =   2.3 MiB   osspd
  2.3 MiB + 306.0 KiB =   2.6 MiB   nacl_helper
  2.7 MiB + 102.5 KiB =   2.8 MiB   gvfs-mtp-volume-monitor
  2.1 MiB + 835.0 KiB =   2.9 MiB   (sd-pam) (2)
  2.8 MiB + 156.0 KiB =   2.9 MiB   polkitd
  2.3 MiB + 831.5 KiB =   3.1 MiB   mission-control-5
  2.6 MiB + 606.5 KiB =   3.2 MiB   tracker-miner-apps
  2.8 MiB + 434.0 KiB =   3.3 MiB   colord
  3.2 MiB + 124.0 KiB =   3.3 MiB   zsh5
  1.9 MiB +   1.5 MiB =   3.4 MiB   nginx (5)
  3.2 MiB + 225.5 KiB =   3.4 MiB   at-spi-bus-launcher (2)
  3.3 MiB + 280.0 KiB =   3.6 MiB   gvfs-afc-volume-monitor
  2.8 MiB + 853.5 KiB =   3.6 MiB   tracker-miner-fs
  3.4 MiB + 307.0 KiB =   3.7 MiB   udisksd
  3.5 MiB + 175.0 KiB =   3.7 MiB   cups-browsed
  3.7 MiB + 181.5 KiB =   3.9 MiB   whoopsie
  3.8 MiB + 101.5 KiB =   3.9 MiB   accounts-daemon
  4.0 MiB + 367.5 KiB =   4.3 MiB   gnome-keyring-daemon
  3.8 MiB + 637.5 KiB =   4.5 MiB   gsd-printer
  4.1 MiB + 550.5 KiB =   4.6 MiB   tracker-miner-user-guides
  2.9 MiB +   2.0 MiB =   5.0 MiB   systemd (3)
  5.6 MiB + 199.0 KiB =   5.8 MiB   NetworkManager
  5.3 MiB + 747.5 KiB =   6.1 MiB   gnome-shell-calendar-server
  5.2 MiB +   1.0 MiB =   6.2 MiB   evolution-addressbook-factory-subprocess
  6.1 MiB +  46.5 KiB =   6.2 MiB   systemd-journald
  5.5 MiB + 860.5 KiB =   6.3 MiB   gnome-tweak-too
  5.5 MiB +   1.2 MiB =   6.7 MiB   evolution-addressbook-factory
  6.4 MiB + 611.5 KiB =   7.0 MiB   gdm-session-worker (2)
  6.9 MiB + 831.5 KiB =   7.7 MiB   tracker-extract
  6.5 MiB +   1.5 MiB =   8.0 MiB   update-notifier
  7.2 MiB +   1.6 MiB =   8.8 MiB   evolution-source-registry
  8.7 MiB + 338.5 KiB =   9.0 MiB   ibus-daemon (2)
  8.0 MiB +   1.1 MiB =   9.0 MiB   gnome-session-binary (2)
  5.7 MiB +   3.7 MiB =   9.3 MiB   php5-fpm (3)
  7.8 MiB +   1.8 MiB =   9.7 MiB   pulseaudio (2)
  7.6 MiB +   2.4 MiB =  10.0 MiB   ibus-ui-gtk3
  9.9 MiB + 507.5 KiB =  10.4 MiB   tracker-store
 11.0 MiB +  74.5 KiB =  11.0 MiB   teamviewerd
 10.0 MiB +   2.0 MiB =  12.0 MiB   ibus-x11 (2)
 14.5 MiB + 599.5 KiB =  15.1 MiB   geoclue
 11.8 MiB +   4.7 MiB =  16.5 MiB   easystroke
 16.2 MiB +   1.8 MiB =  18.0 MiB   goa-daemon
 17.3 MiB +   4.0 MiB =  21.3 MiB   vineyard-indica
 18.8 MiB +   2.8 MiB =  21.5 MiB   evolution-alarm-notify
 23.4 MiB + 499.5 KiB =  23.9 MiB   fwupd
 19.4 MiB +   5.7 MiB =  25.0 MiB   gnome-system-monitor
 24.9 MiB +   1.6 MiB =  26.5 MiB   aptd
 26.8 MiB +   4.6 MiB =  31.4 MiB   gnome-settings-daemon (2)
 28.4 MiB +   5.9 MiB =  34.3 MiB   python2.7 (2)
 34.6 MiB + 760.0 KiB =  35.3 MiB   dbus-daemon (6)
 37.4 MiB +   1.8 MiB =  39.3 MiB   evolution-calendar-factory
 22.1 MiB +  19.6 MiB =  41.8 MiB   nautilus
 54.6 MiB +   2.5 MiB =  57.1 MiB   docky
 71.1 MiB + 107.0 KiB =  71.2 MiB   ipfs
 73.7 MiB +   2.4 MiB =  76.1 MiB   gnome-software
133.9 MiB + 661.5 KiB = 134.6 MiB   dropbox
158.4 MiB +   4.5 MiB = 162.9 MiB   evolution-calendar-factory-subprocess (4)
154.8 MiB +  20.7 MiB = 175.5 MiB   Xorg (2)
507.9 MiB +  19.1 MiB = 527.0 MiB   gnome-shell (2)
473.7 MiB +  93.7 MiB = 567.4 MiB   chrome (16)
---------------------------------
                          2.3 GiB
=================================

dmesg看起来很清楚所以我就不费心在这里发布了......

输出df -h

Filesystem      Size  Used Avail Use% Mounted on
udev            3.9G  3.9G     0 100% /dev
tmpfs           788M   14M  774M   2% /run
/dev/sda4       264G  148G  104G  59% /
tmpfs           3.9G   20M  3.9G   1% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
tmpfs           788M   12K  788M   1% /run/user/120
tmpfs           788M   80K  788M   1% /run/user/1000

此时,共享内存 (shmem) 似乎占用了我所有的内存。我不知道为什么会发生这种情况。

有人能帮忙吗?提前谢谢。我使用 Ubuntu 很长时间了,但这是我第一次遇到这个问题,我不知所措!

答案1

根据df,您的/dev文件系统已满。这是一个 tmpfs,因此存储在共享内存中。通常它只包含非常少量的数据,主要是为内核驱动程序提供文件接口的设备节点,因此某些东西错误地填充了它。您可以仔细du查看哪些文件占用了所有空间。

相关内容