Tuesday, June 22, 2010

Linux's dentry_cache takes all available memory

So for some reason one of my servers had 12G of memory allocated to the dentry_cache that wasn't being reclaimed. Probably a bug in the old version of the Linux kernel that this server is using. The solution that worked for me was:
# sync && echo 2 >/proc/sys/vm/drop_caches
If you're curious as to what this does, RTFM.

2 comments:

abdussamad said...

Did you figure out a fix for this? I have the same problem on my centos 6 box and it's unacceptable!

There is a thread about this problem on the redhat mailing list:

http://comments.gmane.org/gmane.linux.redhat.release.rhel6/332

Is this the same problem you are seeing?

tsuna said...

I upgraded this box and no longer see the issue, so I never really took the time to get to the bottom of this. I actually stopped using CentOS. Probably the newer kernel that came with the new distro doesn't have this problem/bug.