These are the calculations I make to get the numbers for the green, blue and yellow bars in the memory meter:
- Total used memory =
MemTotal
-MemFree
- Non cache/buffer memory (green) = Total used memory - (Buffers + Cached memory)
- Buffers (blue) =
Buffers
- Cached memory (yellow) =
Cached
+SReclaimable
-Shmem
- Swap =
SwapTotal
-SwapFree
In the htop source code: linux/LinuxProcessList.c and linux/Platform.c.