7

Whenever I use top and htop commands to see memory stats, they are always different as shown in figures. Which should I trust?

enter image description here

0

2 Answers 2

5

If you subtract the buffers and the cache usage from the memory used shown by top, you get 15544012 - 3668284 - 92876 = 11782852 = ~ 11506.7*1024, which lines up with the value htop shows.

4

I can see that there is a pretty fair time difference between both the commands being run looking at the uptime info.

I checked running a top and htop on my machine side by side and the output is attached.

htop-top-free

But, you are right about the memory showing up different even if checked side by side.

This is because htop counts cached memory and buffers into free memory, whereas top command does not. With reference to my screenshot, the free memory would be

3554544k - 49672k - 975192k = 2529680k used memory

that gives pretty close results with 2543MB from htop

You must log in to answer this question.

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