My situation is pretty simple: I backup-ed some of my documents and put them on a NAS and since I rather transfer one big file instead of million small ones, I created a tar
tar cf backup/2013-07-12-pictures.tar Pictures
My Pictures
directory contains about 12GB of data and what happens is, that my cache fills up steadily. If I tar some more files (e.g. my projects, whatever) it doesn't take long and all of my 32GB RAM are used:
sheldor:~$ free -g
total used free shared buffers cached
Mem: 31 31 0 0 0 27
-/+ buffers/cache: 2 28
Swap: 29 0 29
At this point, although the mouse and the system is in general responsible, starting programs (which reads from disk) takes ages. Literally ages: I have an SSD and starting Chrome which usually takes a second needs now about 2 minutes.
Now you find all those posts on the internet about that it is bad to clear the cache and so on. Here, on Ask Ubuntu you find such a post too which saved my life by providing the command
sudo sync && sudo sysctl -w vm.drop_caches=3
If you read through the comments, you find for instance this here:
This is not a problem, this is how the page cache works. It will keep things cached as long as possible, but release items automatically when memory pressure from other applications increases. Clearing it up manually is unnecessary. – Caesium Nov 22 '11 at 16:08
What? My system (Intel Core i7 3.50GHz × 8, 32GB RAM, NVidia Gtx 590) was frozen after a simple tar. I mean, how much pressure do I have to make before my cache is freed automatically?
Question: Is there a way to tweak settings so my cache gets cleared more often? Or is this just something I have to live with?