howto flush cache and buffers ?

David Timms dtimms at iinet.net.au
Tue Mar 27 14:27:44 UTC 2007


I'm interested to know if it is possible to forcibly flush the caches 
and/or buffers ?

I googled and found a good article on how the buffers/caches are used, 
and that with kernel tuning, the builder can change the behaviour. Also, 
you can write a program that grabs all of memory causing the caches or 
buffers to be flushed, then the program releases the memory it grabbed, 
leaving large amounts of free memory.

But are there more direct ways to make memory available (even though it 
is not always a good idea - I understand the kernel does a good job at 
using all available memory with just a small amount ready for immediate 
assignment as required.):
Does it hurt to do: swapoff -a && swapon -a ?
How about buffers ?
How about cache ?
Also it would seem that trashapplet and beagled is consuming large 
amounts of memory: is this really the case ?

eg on my PC at the moment:
top - 00:10:24 up  5:13,  2 users,  load average: 0.29, 0.29, 0.20
Tasks: 130 total,   3 running, 127 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.3%us,  0.3%sy,  0.0%ni, 99.0%id,  0.0%wa,  0.0%hi,  0.3%si, 
0.0%st
Mem:    514160k total,   472704k used,    41456k free,     7596k buffers
Swap:  1859808k total,      180k used,  1859628k free,   225984k cached

   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND 

25998 davidt    15   0  135m  47m  18m S  0.0  9.4   0:23.96 
thunderbird-bin
  3091 mysql     15   0  133m  18m 3636 S  0.0  3.6   0:00.25 mysqld 

  3685 davidt    17   0  121m  30m  18m S  0.0  6.1   0:05.91 nautilus 

  3750 davidt    15   0  103m 9520 7132 S  0.0  1.9   0:00.15 
trashapplet
  3822 davidt    15   0 91236 5612 4652 S  0.0  1.1   0:00.05 
evolution-data-
  3712 davidt    15   0 89624  23m  12m R  0.0  4.7   0:15.46 beagled 

  3919 davidt    15   0 81976  14m 9280 S  0.3  2.9   0:02.77 
gnome-terminal
  3752 davidt    15   0 66296  10m 7956 S  0.0  2.2   0:02.34 
wnck-applet
  3683 davidt    15   0 66256  12m 8788 S  0.0  2.4   0:00.95 
gnome-panel
  3798 davidt    15   0 65996  10m 7732 S  0.0  2.0   0:00.20 
mixer_applet2
  3714 davidt    15   0 63136 8856 7452 S  0.0  1.7   0:00.11 nm-applet 

  3667 davidt    15   0 62956 5376 4012 S  0.0  1.0   0:00.12 
gnome-power-man
===
Thanks, DaveT.




More information about the fedora-list mailing list