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

cachehtopmemcachedmemoryUbuntu

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?

Best Answer

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