We all know Linux is known for good memory management but is it really? It seems all on its own with hardly anything running that you can come back in days or weeks and find that almost all of your RAM is used!
And many will say "no don't worry it's buffers for optimization" but it doesn't seem to help because what is in buffers is not available to use for new programs running or ones that allocate more RAM as far as I can tell.
The reason I know this is because you can see that SWAP will get used so if there was enough RAM not eaten by buffers it should be freed for new or growing memory allocations but it is not.
So how do we fix this or clear out Linux's memory buffers to free RAM?
[firstname.lastname@example.org ~]# free -m total used free shared buffers cached Mem: 3851 3738 113 0 3269 222 -/+ buffers/cache: 246 3605 Swap: 2999 0 2999 [email@example.com ~]# echo 3 > /proc/sys/vm/drop_caches [firstname.lastname@example.org ~]# [email@example.com ~]# [firstname.lastname@example.org ~]# free -m total used free shared buffers cached Mem: 3851 146 3705 0 0 9 -/+ buffers/cache: 137 3714 Swap: 2999 0 2999
Now we can see that we have our RAM back!