how to explain free buffers and cached memory usage

本文详细解析了Linux系统的内存使用情况报告,包括物理内存(RAM)和交换空间(swap)的使用状态。通过理解报告中的各项指标,如buffers、cache等,帮助读者深入掌握Linux内存管理机制。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 free -m
                   total       used       free     shared    buffers     cached
Mem:         48269       2424      45845          0        139       1120
-/+ buffers/cache:       1164      47105
Swap:         8197          0           8197

 

 

                   total       used       free     shared    buffers     cached
Mem:           A             B            C            D             E              F
-/+ buffers/cache:      G            H
Swap:         I              J             K

 

Note:

A=B+C

A=G+H

G=B-E-F

H=C+E+F

 

The display columns mean:

  • total: Your total (physical) RAM (excluding a small bit that the kernel permanently reserves for itself at startup); that's why it shows ca. 11.7 GiB , and not 12 GiB, which you probably have
  • use: memory in use by the OS
  • free: memory not in use

total=use+free

  • shared/buffers/cached: This shows memory usage for specific purposes; the numbers are included in the value for "use". This is why the second line gives the numbers for used/free minus the sum cached+buffers.

The first line is about your physical memory (RAM), the last line "swap" gives the same information about swap space usage (i.e. memory contents that have been temporarily moved to disk). The second line gives the numbers for used/free minus the sum cached+buffers (because that value is often more meaningful).

To actually understand what the numbers mean, you need a bit of background about the virtual memory (VM) subsystem in Linux. Just a short version: Linux (like most modern OS) will always try to use free RAM for caching stuff, so "free" will almost always be very low. Therefore the line "/+ buffers/cache:" is shown, because it shows how much memory is free when ignoring caches; caches will be freed automatically if memory gets scarce, so they do not really matter.

A Linux system is really low on memory if the free value in "/+ buffers/cache:" gets low.

For more details about the meaning of the numbers, see e.g. the questions:

http://serverfault.com/questions/23433/in-linux-what-is-the-difference-between-buffers-and-cache-reported-by-the-fr

http://serverfault.com/questions/9442/why-does-red-hat-linux-report-less-free-memory-on-the-system-than-is-actually-ava

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值