Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

My Centos box seems to be using lots of caching, most of the used memory is used for cache, how can I find out what the cache is for?

             total       used       free     shared    buffers     cached
Mem:      16439708   10469864    5969844          0     197936    9534176
-/+ buffers/cache:     737752   15701956
Swap:     16763816          0   16763816
share|improve this question

3 Answers 3

up vote 6 down vote accepted

The cache memory in Linux-based machines is often used to cache disk blocks into memory to prevent writing to the harddisk and speed up I/O operations. Also, a lot of free memory is cached and released when it is actually required.

When interpreting the output of free, you should look at the second row for the actual memory usage.

The above numbers can be interpreted as:

  • 9534176 kilobytes cached memory
  • 737752 actually used memory
  • 15701956 actually free memory

For more information, take a look at http://www.faqs.org/docs/linux_admin/buffer-cache.html.

share|improve this answer

You can look at /proc/slabinfo or use the command slaptop to have a top-like interface to the cache objects.

share|improve this answer
    
The appropriate command is slabtop, not slaptop :) –  Aron Rotteveel Jan 14 '10 at 11:10

The cache is for speed up the disk I/O operations.

As Linus Torvalds once said, "free memory is bad memory". Linux kernel uses unused (by system/applications) memory for cache, should a program require more memory, the system gets it from cache.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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