howto flush cache and buffers ?



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.

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list



Relevant Pages

  • Re: [RFC PATCH 0/3] Avoid the use of congestion_wait under zone pressure
    ... When issuing subsequent writes after I dropped caches to get a clean start I get this in Buffers/Caches from Meminfo: ... It stays at ~85M with more writes which is approx 50% of my free 160M memory. ... It can be said that once Buffers reached the 65M level all following read loads will have the bad throughput. ... I had the initial revert right and screwed up reverting from ...
    (Linux-Kernel)
  • Re: Kernel 2.6.9 Doesnt release Buffer and Cached Memory?
    ... It's perfectly normal:) Buffers and caches uses up whatever RAM you ... You should look at the 2nd line to see how much memory ... On Fri, 3 Dec 2004, Yang Xiao wrote: ...
    (Fedora)
  • Re: Running low in memory
    ... Nearly all of your memory is used for buffers and caches, but this part is not really "in use". ... But as long as no program needs the memory, it is better to use it for buffers or caches than leave it unused. ...
    (comp.os.linux.misc)
  • Re: svn - but smaller?
    ... Such buffers exist during the entire program's lifetime even if they ... rather than just having a gigantic portion of memory allocated ... limits of the underlying application. ... larger than 2048 might warrant use of malloc. ...
    (freebsd-stable)
  • Re: UMA cache back pressure
    ... done in memory allocation last years improved situation. ... it cycling over all CPUs to purge their per-CPU UMA caches. ... Even on my workload with ZFS creating strong memory pressure I still have mbuf* zones buckets almost maxed out. ...
    (freebsd-hackers)