Linux disk cache
Linux has a supposedly good memory management feature that will use up any “extra” RAM you have to cache stuff.
Accessed file’s content gets cached in RAM for fast access eventhough we might not need it later in RAM.
$ free -m
total used free shared buffers cached
Mem: 1504 1490 14 0 24 809
-/+ buffers/cache: 656 848
Swap: 0 0 0
In Linux, you can clear the cache of the memory by using
$ sync; echo 3 > /proc/sys/vm/drop_caches; echo 0 > /proc/sys/vm/drop_caches
or
$ sync; sysctl -w vm.drop_caches=3; sysctl -w vm.drop_caches=0
$ free -m
total used free shared buffers cached
Mem: 1504 650 854 0 1 67
-/+ buffers/cache: 581 923
Swap: 0 0 0
sync should be run because this is a non-destructive operation, and dirty objects are not freeable. So you run sync in order to make sure all cached objects are freed.
Doing echo 3 is clearing pagecache, dentries and inodes but you could choose echo 1 to free pagecache only or echo 2 to free dentries and inodes.
-
Recent
- Set Time Zone + Fedora 18
- Fedora 17 + Tata Photon (Huawei)
- Fedora 17: Install OpenSSH Server
- Change the default keyring password
- Error: Could not stat() command file ‘/usr/local/nagios/var/rw/nagios.cmd’!
- Gnone 3.X adding personal launcher
- Gnome 3.x Change Panel
- KDE remove autostart programs
- GPS on Linux
- Debian Squeeze change root password
- Download YouTube Videos on Linux
- Pidgin + The certificate for omega.contacts.msn.com could not be validated
-
Links
-
Archives
- April 2013 (1)
- September 2012 (2)
- August 2012 (2)
- July 2012 (2)
- November 2011 (1)
- July 2011 (1)
- April 2011 (1)
- January 2011 (1)
- November 2010 (1)
- September 2010 (2)
- July 2010 (3)
- March 2010 (1)
-
Categories
-
RSS
Entries RSS
Comments RSS