The following three outputs were taken essentially simultaneously:
top:
top - 02:54:36 up 2 days, 13:50, 3 users, load average: 0.05, 0.05, 0.09
Tasks: 181 total, 1 running, 179 sleeping, 0 stopped, 1 zombie
%Cpu(s): 2.5 us, 0.8 sy, 0.0 ni, 96.6 id, 0.1 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem: 16158632 total, 11234480 used, 4924152 free, 844 buffers
KiB Swap: 16777212 total, 0 used, 16777212 free, 10640832 cached
free -h:
total used free shared buffers cached
Mem: 15G 10G 4.7G 0B 844K 10G
-/+ buffers/cache: 578M 14G
Swap: 15G 0B 15G
htop:
free and top seem to agree. In top there is 11234480 KiB used, subtracting 10640832 KiB cached gives 579.7 MiB, which is pretty close to what free reports under used +/- buffers/cache.
However htop is reporting 1836 (MiB) used, which is neither here nor there as far as I can see. Where does this difference come from? htop is clearly not including the cached data, but it is still reporting more than three times the memory usage of free or top.
I am aware that there are many similar questions, but I haven't come across one that explains this discrepancy (the confusion usually seems to be only the with/without cache counting).
Edit: I should mention that I am running openSUSE, and I see the same kind of discrepancy in both version 12.2 and 12.3 RC1.
Edit2: The included version of htop is 1.0.1. I have also compiled version 1.0.2 from source and see the same discrepancy then as well.