大网数据广告活动
服务器运维问答

Why do free -m and htop show different amounts of total memory?

· 52CE 我爱测

When I run free -m , I get different data from when I use htop . free -m : total used free shared buff/cache available Mem: 992 396 149 23 446 392 Swap: 0 0 0 htop : Mem[|||||||||||||||||||||||||||||||||||||||||||||||||456 ] htop…

问题原文

原帖链接 · APixel Visuals · CC BY-SA 3.0

When I run free -m, I get different data from when I use htop.

free -m:

              total        used        free      shared  buff/cache   available
Mem:            992         396         149          23         446         392
Swap:             0           0           0

htop:

Mem[|||||||||||||||||||||||||||||||||||||||||||||||||456        ]

htop screenshot:
https://gyazo.com/71cbb11b6cf2609082a06a7c5acf1aaf

Information:

  • RAM: 1GB
  • OS: Ubuntu 16.04.3

I know for a fact that I have 1GB of total RAM, showing that free -m is accurate with that. But how come htop claims that the max RAM is only about 512MB? I can say that I had 512MB until I upgraded to 1GB about 12 hours ago. I did reinstall htop but that didn't help; I still got the same results. So why is it that free -m claims that I have 992MB total RAM and htop claims that I have about 512MB?

已采纳解答

原帖链接 · user9517 · CC BY-SA 3.0

Perhaps you are misinterpreting what htop is telling you, I don't see anywhere that htop says you only have 512MB of memory. You can get a definitive answer by configuring htop to display numbers rather than a graph. Go to settings F2 -> Meters -> Memory and then press the space bar. This will rotate through the memory display options, one of which is text e.g.

Mem:31.4G used 6.71G buffers 4.15M cache: 2.0G

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-12-21)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。