Ubuntu 18.04 uses too much RAM
Emily Wong
The command top in Ubuntu 18.04 shows that 4GB RAM is being used even if I don't run anyhing.
Results of top:
Results of free -hm:
PC information:
31 Answer
Short answer: the "missing" memory is being used for kernel buffers and (mostly!) the VM / file system page cache.
This is a good thing. It is making your file system access faster.
According to the output from free you have:
Total: 7.0G
used: 3.9G
free: 1.2G
shared: 11m
buf/cache: 1.9G
available: 2.9GThe manual entry for free explains these columns as follows:
total Total installed memory (MemTotal and SwapTotal in /proc/mem‐ info) used Used memory (calculated as total - free - buffers - cache) free Unused memory (MemFree and SwapFree in /proc/meminfo) shared Memory used (mostly) by tmpfs (Shmem in /proc/meminfo) buffers Memory used by kernel buffers (Buffers in /proc/meminfo) cache Memory used by the page cache and slabs (Cached and SRe‐ claimable in /proc/meminfo) buff/cache Sum of buffers and cache available Estimation of how much memory is available for starting new applications, without swapping. Unlike the data provided by the cache or free fields, this field takes into account page cache and also that not all reclaimable memory slabs will be reclaimed due to items being in use (MemAvailable in /proc/mem‐ info, available on kernels 3.14, emulated on kernels 2.6.27+, otherwise the same as free)While the kernel buffers are probably not easily reclaimable, the kernel will happily free up the page cache and give the memory to applications ... if there is actual demand for it. And clearly there isn't a demand at the moment.
In summary, free says that there is 2.9G available for instant use, and a further 1.9G ... most of which can be freed up at a moments notice.