Why is so much RAM being cached?

2

free -m

             total       used       free     shared    buffers     cached
Mem:         32086      30156       1930         51        564      26606
-/+ buffers/cache:       2985      29101
Swap:        31997         12      31985

Out of my 32 GB of ram, why is 26 GB cached? What is the implication of caching? Does that mean I can't use them and will run out of memory soon? Or is this actually a good thing?

user486019

Posted 2015-08-20T03:57:06.000

Reputation: 21

2linuxatemyram.com. 'Nuff said. – Deltik – 2015-08-20T04:08:06.673

3Unused memory is wasted memory. Anything that is not needed for an app or OS is used for cache to speed up access to storage. It will be released if something needs it. – Paul – 2015-08-20T04:08:38.077

Answers

1

Yes, it's a good thing. Out of your 32 GB of ram, the 26 GB is 'cached' because your programs do not need it, therefore the OS puts it to good use by storing recently accessed files in it.

If a program requests more memory, the OS will just reclaim parts of the cache for it.


There's one exception, though. Files stored in "tmpfs" filesystems such as /tmp are actually stored in the page cache, so they also count as 'cached' memory usage, but of course cannot be automatically reclaimed, until you delete them yourself.

Therefore you should check df -Tht tmpfs, make sure you don't have any huge files in there.

user1686

Posted 2015-08-20T03:57:06.000

Reputation: 283 655