Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On my linux system I find that the free memory is continuously reduced.I use free -m to get the free memory size.

But after I execute

echo 3 > /proc/sys/vm/drop_caches

the size of free memory returned to a normal value.

I know this command is used to free pagecache, dentries and inodes.

But is there any way to know which application cached data and what data I freed?

share|improve this question

migrated from Sep 1 '11 at 11:21

This question came from our site for professional and enthusiast programmers.

Thank you. I really misinterpreted free. But both the "/+buffers/cache" are reducing and I still want to get the way to print the cache content – Ryker.Wang Sep 1 '11 at 6:29
I don't think the kernel keeps track of which program was responsible for a given page being cached. It'd incur a lot of memory overhead, and what would it do when there are several processes accessing the same data (and thus all contributing to it being cached)? But if the amount of free memory on the "-/+ buffers/cache" line is going down, that's not cache usage, it's something else. Maybe a memory leak in an app. – Wyzard Sep 1 '11 at 6:38
Don't do that. Having a lot of data cached is a Good Thing, as it makes that data immediately available if it should be needed, while the cache can be immediately reallocated to another process if the memory is needed elsewhere. Empty memory is wasted, so let the kernel cache as much as it wants to. – Dave Sherohman Sep 1 '11 at 8:15

The short answer is no.

The slightly longer answer is that the caches you free when writing to /proc/sys/vm/drop_caches aren't really linked to applications. They are created by the kernel and various kernel subsystems (typically the vm, block and fs subsystems) that have no real notion of applications.

The good news is that you shouldn't have to worry about them at all under normal use as the kernel will try to cache as much as possible in every situation unless it is explicitly told not to and then drop the cache as soon as it needs the memory for something else.

share|improve this answer

Your Answer


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