1

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
6

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.

2

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

  • 1
    The appropriate command is slabtop, not slaptop :) – Aron Rotteveel Jan 14 '10 at 11:10
0

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.

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.