1

我正在使用“free -m -t”命令来监控我的 linux 系统并获取

             total       used       free     shared    buffers     cached

Mem:         64334      64120        213          0        701      33216

-/+ buffers/cache:      30202      34131

Swap:          996          0        996

Total:       65330      64120       1209

这意味着用户进程使用了​​ 30GB 的物理内存。

但是当使用 top 命令并按内存使用排序时,所有应用程序进程只使用 3~4GB 的内存。

为什么会发生这种不一致?

4

1 回答 1

1

As I understand it, the amount of memory that top shows as used includes cold memory from older processes that are not running anymore. This is due to the fact that in case of a restart of said process, the required data may still be in memory, enabling the system to start the process faster and more efficiently instead or always reloading the data from disk.

or, in short, linux generally frees cold data in memory as late as possible.

Hope that clears it up :)

于 2012-09-19T06:29:39.253 回答