Clear Memory Cache

Asked by Zach Grogg on 2012-12-27

I need to know how to manually clear out the unused cached files in the system memory. I have a 3.2GHz hex-core processor with 16GB of memory running Ubuntu 10.04 64-bit. I have the system monitor applet on the top panel of my screen with the important computer vitals: CPU, memory, network, HDD, and I also have the CPU temperature and temps of both hard drives.
 I have noticed using this that the system cache in the memory slowly fills itself up and bogs the system down to a crawl. I have also noticed that when I copy/paste anything, a copy of the files moved stays in the cache and will quickly fill it up.

Yes, I know that Linux has excellent memory management. It just doesn't work for me. I want to be able to clear out anything that currently isn't in use, preferably using the command line.
 I would also like to modify the policies regarding what the memory stores and how long it holds on to unused files if possible.

I'm including a link to a screenshot of my system monitor applet. The cache is represented by the red bar in the middle. This is its current state a few hours after resetting the system. I have a Virtual Box running which is hogging 4GB of the green memory.

Thank you.

Question information

English Edit question
Ubuntu ubuntu-meta Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:

echo 3 | sudo tee /proc/sys/vm/drop_caches

Will clear the caches. You can then run:

free -m

and see the actually used RAM etc.

Zach Grogg (yearomonkey) said : #2

Thanks actionparsnip, that solved my question.