Every so often, I find my desktop, well, Firefox that is, a bit sluggish due to the amount of memory being consumed (upwards of 2GB!). The Linux Kernel has very efficient memory management that occasionally frees any cached memory on the system. However it’s not always when you need it.
sync; sysctl -w vm.drop_caches=3
This is effectively the same as calling
sync; echo > /proc/sys/vm/drop_caches
Part of the problem I had was a left over setting from some kernel memory testing I had done some time ago, where I left this parameter set
This equates to 99% of memory will be cached. For the average person this could be either left to the default value (60) or omitted completely, or set to a lower value to cache less but not too little as to ruin your experience.