Ubuntu – High SHMem memory usage!

16.04memory leakmemory usageramubuntu-gnome

I have tried everything I could think of so here I am asking this question here…

I have a computer that has 8 GB of RAM. After booting the computer, logging in, not opening any applications and leaving the computer on overnight, the memory usage skyrockets and all 8 gigabytes of RAM are used. At first I suspected it was just a caching issue but after another 5 hours, 1.2 GB of the swap was used (with NO applications open).

To further disprove the fact that it could be caches or memory leaking applications here is the output of free -m:

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

This report was taken while I am writing this question after a reboot so the situation is not as bad. You can see that I only have about a gigabyte of free memory while the cached memory is at almost 5 GB!

This started happening after upgrading to Ubuntu Gnome 16.04 from Ubuntu Gnome 15.10.

Here is the output of 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

Here is the output of the ps_mem program:

 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 looks clear so I won't bother posting that here…

The output of 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

At this point, it looks like the shared memory (shmem) is hogging all my memory. I have no idea why this is happening.

Can anybody be of assistance? Thanks so much in advance. I have used Ubuntu for a long time but this is the first time I have run into this issue and I am stumped!

Best Answer

According to df, your /dev filesystem is full. This is a tmpfs, and so is stored in shared memory. Normally it should only contain a very small amount of data, mainly device nodes that provide a file interface to kernel drivers, so something is incorrectly filling it up. You can dig around with du to see what files are taking up all of the space.

Related Question