总内存和空闲内存有什么区别

Haf*_*fiq 13 linux memory ram

我有一个安装了 Centos 7 的桌面系统。它有 4 核和 12 GB 内存。为了找到内存信息,我使用free -h命令。我有一个困惑。

[user@xyz-hi ~]$ free -h
              total        used        free      shared  buff/cache   available
Mem:            11G        4.6G        231M         94M        6.8G        6.6G
Swap:          3.9G        104M        3.8G
Run Code Online (Sandbox Code Playgroud)

在总列中,说总计为 11GB(这是正确的),在可用的最后一列中,说 6.6GB 和使用的是 4.6G。

如果已用内存为 4.6GB,则剩余内存应为 6.4 GB (11-4.6=6.4)。什么是上述输出的正确解释 总内存和可用内存和空闲内存有什么区别?如果某些新应用程序需要 1 GB 以上的内存,我是否会出现内存不足的情况?

Haf*_*fiq 17

man free 命令解决了我的问题。

DESCRIPTION
       free  displays the total amount of free and used physical and swap mem?
       ory in the system, as well as the buffers and caches used by  the  ker?
       nel.  The  information  is  gathered by parsing /proc/meminfo. The dis?
       played columns are:

       total  Total installed memory (MemTotal and SwapTotal in /proc/meminfo)

       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, available
              on kernels 2.6.32, displayed as zero if not available)

       buffers
              Memory used by kernel buffers (Buffers in /proc/meminfo)

       cache  Memory  used  by  the  page  cache and slabs (Cached and Slab 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/meminfo, avail?
              able on kernels 3.14, emulated on kernels 2.6.27+, otherwise the
              same as free)
Run Code Online (Sandbox Code Playgroud)