1

I am getting sum of all reserved memory in KBs by using following command:-

ps aux --sort -rss | awk '{sum +=$6} END {print sum}'
OUTPUT: 14746220 i.e. 14.74GB

However free -g returns 27GB as used. Why there is a difference between the two outputs? Doesn't ps shows all the memory allocation?

1

I had the exact same situation. htop and top both reported about 95% usage (excluding buffers/caches) as did free -m. When summing up the processes from ps, I only was using about 10% of the memory. I found these sites to be invaluable:

In my case it was the dentries/inode cache that was filling the memory. I don't know why free didn't count these as buffers/cache. You can flush this information with the following command, which does not hurt the system:

echo 3 > /proc/sys/vm/drop_caches

Information about this is detailed here: https://linux-mm.org/Drop_Caches

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.