查看内存信息
free
1 | hegongshan@hgs:~/Desktop$ free |
$$
\begin{aligned}
used
&= total - free - buffers - cache \\
&= 2028064 - 290904 - 969296 \\
&= 767864
\end{aligned}
$$
实际上,free的结果也是从/proc/meminfo中解析得到的。
/proc/meminfo
1 | hegongshan@hgs:~/Desktop$ cat /proc/meminfo |
free | /proc/meminfo | 值 |
---|---|---|
Mem total | MemTotal | 2028064 kB |
Mem free | MemFree | 290904 kB |
shared | Shmem | 8424 kB |
buff/cache | Buffers + (Cached + SReclaimable) = 50356 + (865900 + 53040) | 969296 kB |
available | MemAvailable | 1102548 kB |
Swap total | SwapTotal | 459260 kB |
Swap free | SwapFree | 457968 kB |