19

When I run free -m on my command-line, it shows my used memory as show below. When I run htop the used memory shown is very low.

Why is that? Is it some other kind of representation? I am new to Linux. So I am totally blank on these stuff.

   total   3    used       free     shared    buffers     cached
   5863       4980        882          0        903       3025

htop:

Mem[|||||#####*****1076/586]

The used memory in free shows 4980MB and in htop shows 1076MB. What do they actually represent?

1 Answer 1

20

Main difference is htop counts cached memory and buffers into free memory, whereas free command does not. That would give using free command

4980 - 3025 - 903 = 1052 used memory

that gives pretty close results with 1076 from htop. Difference can be explained here. (That explains it on openSUSE I think on Ubuntu it will be nearly same), or if you are not running both commands at the same time.

Here is explanation why buffers and cached memory is sometimes considered free.

1
  • This doesnt seem to be true anymore: In my case, according to free, used - buffers/cache is < 0 and that does not make much sense
    – phil294
    Jul 24, 2020 at 17:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .