Note that when you RAM usage goes up, not all of the RAM is actually used in an active sense -- some may be reserved. Another factor to take into account is that you actually DO want to use as much RAM as possible as long as it improves performance, and this is done via caching. What's shown here is simply how to clean that cache.
So is cleaning that cache a good thing? Well, sometimes. Empirically, it seems like dropping the caches can help if you've been doing something that caused a lot of ram to be used, but which is no longer running. Such as something heavily graphical (e.g. using VMD and rendering something) or a virtual machine.
See e.g. here for a discussion with comments: http://catalin-festila.blogspot.com.au/2011/06/myth-of-dropcaches.html
Anyway.
At the beginning this is how it looked (free -m):
To free up the ram cache, dototal used free shared buffers cached Mem: 7991 7488 503 0 1097 379 -/+ buffers/cache: 6011 1980 Swap: 15257 419 14838
me@beryllium:~$ sudo su
[sudo] password for me: root@beryllium:/home/me# sync root@beryllium:/home/me# echo 3 > /proc/sys/vm/drop_cachesAnd when we're done it looks like this:
Our swap usage hasn't changed, but the apparent free RAM has increased significantly. And my computer feels snappier.total used free shared buffers cached Mem: 7991 3503 4488 0 47 147 -/+ buffers/cache: 3308 4683 Swap: 15257 419 14838
Often the need to free up RAM is precipitated by the presence of memory leaks though, since these are often manifested by the slow increase in the amount of RAM a program is using. Older versions of gnome-shell (including the one presently used in Wheezy) are known culprits, and ECCE has a tendency to eat up RAM like there's no tomorrow when running for too long (still working on getting hard numbers for it).
No comments:
Post a Comment