After an upgrade from 16.04 to 18.04, the amount of memory in use, even after a reboot, is massive. The System has 64GB of ram. Prior to upgrade, typical usage was about 20% (12GB). Ater the reboot, it's up at the 80% range.

$ cat /proc/meminfo | grep Mem
MemTotal:       65898276 kB
MemFree:        12725584 kB
MemAvailable:   18079892 kB

Nothing in 'top' shows a high memory usage. Biggest one is about 1.3Gb resident, with a few in the GB range. Nothing that would add up to 45.7 GB currently in use.

$ps -A  --sort -rss -o comm,pmem | head -n 8 
COMMAND         %MEM
TestServr        2.0
java             1.5
java             1.0
lwsmd            0.6
gnome-shell      0.5
systemd-journal  0.4
gnome-shell      0.2

Also, Gnome-process-monitor is semi-useless as it seems to be suffering from a bug where it won't show all processes, even if you click on "All Processes".. Even if you run it as root.

What options exist for plundering the /proc filesystem to find out what process all that extra memory is allocated to?


Note, this is with almost nothing running on the system.

$ free -h
              total        used        free      shared  buff/cache   available
Mem:            62G         43G        9.0G         69M        9.9G         18G
Swap:          7.6G          0B        7.6G

And this is after a fresh boot with almost no services running (not even logged in to the GUI yet, ~250 processes running, mainly system stuff like GDM, system daemons, etc.).

$ cat /tmp/free.txt 
              total        used        free      shared  buff/cache   available
Mem:            62G         40G         21G        3.6M        754M         21G
Swap:          7.6G          0B        7.6G

Full /proc/meminfo

$ cat /proc/meminfo
MemTotal:       65898276 kB
MemFree:         9482940 kB
MemAvailable:   19036072 kB
Buffers:          390356 kB
Cached:          8936484 kB
SwapCached:            0 kB
Active:          8718412 kB
Inactive:        4002576 kB
Active(anon):    3405360 kB
Inactive(anon):    59612 kB
Active(file):    5313052 kB
Inactive(file):  3942964 kB
Unevictable:        1856 kB
Mlocked:            1856 kB
SwapTotal:       7999484 kB
SwapFree:        7999484 kB
Dirty:               528 kB
Writeback:             0 kB
AnonPages:       3395996 kB
Mapped:           755484 kB
Shmem:             70832 kB
Slab:            1141644 kB
SReclaimable:    1022476 kB
SUnreclaim:       119168 kB
KernelStack:       18736 kB
PageTables:        85152 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:    19977100 kB
Committed_AS:   13634420 kB
VmallocTotal:   34359738367 kB
VmallocUsed:           0 kB
VmallocChunk:          0 kB
HardwareCorrupted:     0 kB
AnonHugePages:         0 kB
ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB
CmaTotal:              0 kB
CmaFree:               0 kB
HugePages_Total:   20480
HugePages_Free:    19430
HugePages_Rsvd:      320
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:      721640 kB
DirectMap2M:    22274048 kB
DirectMap1G:    45088768 kB

The memory is most likely used for the disk cache. Try the following:

$ cat /proc/meminfo | grep -e Mem -e Cached
MemTotal:       32921424 kB
MemFree:        29783076 kB
MemAvailable:   30852280 kB
Cached:          1467132 kB
SwapCached:            0 kB

or use free

$ free -h
              total        used        free      shared  buff/cache   available
Mem:            31G        1.6G         28G         74M        1.5G         29G
Swap:            0B          0B          0B

The disk cache is cleared immediately clear, if any applications requires memory. The default behavior of the kernel is to use all available free memory for caching. You can clear the disk cache with (see this post):

$ echo 3 | sudo tee /proc/sys/vm/drop_caches 
  • Cached: 9632976 kB - so, about 9GB cached. There's still like 20-25GB missing that I can't figure out where it's allocated.
    – ELadner
    Sep 28 '18 at 15:16
  • what is the output of free? Can you add also the complete output of cat /proc/meminco Sep 28 '18 at 15:39
  • Added updates to OP.
    – ELadner
    Oct 2 '18 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.