htop and psutil don’t use the same definition of “used memory.” On Linux, /proc/meminfo exposes several categories (Buffers, Cached, SReclaimable, etc.), and each tool decides which of these counts as “used.”
psutil memory
available memory: the memory that can be given instantly to processes without the system going into swap. This is calculated by summing different memory metrics that vary depending on the platform. It is supposed to be used to monitor actual memory usage in a cross platform fashion.
[Psutil memory](https://psutil.readthedocs.io/en/latest/index.html#psutil.virtual_memory)
htop:
"Used" is calculated as the total - (free+buffers+cache+shared). Shows “How much of RAM currently holds something”
This method of calculation, which subtracts free, buffer, and cache memory from the total, is considered an older approach.
It differs from the more modern calculation used by tools like free and top, which use the MemAvailable field from /proc/meminfo to determine used memory as Used Memory=MemTotal−MemAvailable.
The MemAvailable value is considered a more accurate representation of memory immediately available for new processes, as it accounts for memory that cannot be freed quickly, such as dirty pages
https://www.reddit.com/r/linuxquestions/comments/1de8sx2/htop_ram_usage_value_why/
htop and psutil don’t use the same definition of “used memory.” On Linux, /proc/meminfo exposes several categories (Buffers, Cached, SReclaimable, etc.), and each tool decides which of these counts as “used.”
psutil memory
htop: