another article: http://www.linuxfly.org/post/320/
?
1. Pre- clean memory usage ?
Free-m
2. start cleaning up ??
Echo 1 >/proc/sys/vm/drop_caches
3. memory usage after cleanup ?
Free-m
4. complete !
To view the number of memory bars command:
Dmidecode?|? Grep?-a16? "Memory?" device$ "
?
??
??
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
??
??
??
# Sync
# echo 1 >/proc/sys/vm/drop_caches
?? Echo 2 >/proc/sys/vm/drop_caches
?? Echo 3 >/proc/sys/vm/drop_caches
cache release:
to free Pagecache:
echo 1 >/ Proc/sys/vm/drop_caches
to free dentries and inodes:
echo 2 >/proc/sys/vm/drop_caches
to free Pagecache, Dentries and Inodes:
echo 3 >/proc/sys/vm/drop_caches
description, best before release sync a bit to prevent data loss.
because LINUX the kernel mechanism, generally do not need to deliberately release the already used Cache . These cache Contents can increase the file and read and write speed.
First , Free command How to look at memory
?
[[email protected]? proc] #?free
Total??? Used??? Free????? Shared?buffers?cached
Mem:?515588?295452?220136?0?????? 2060??? 64040
-/+?buffers/cache:?229352?286236
swap:?682720?112?682608
The first line describes the memory state used by the system in a global perspective:
Total -- Total Physical Memory
used-- memory is used, this value is generally larger because the value includes thecache+memory used by the application
Free -- memory that is not being used completely
gkfx-- Application Shared Memory
buffers-- cache, primarily for directory aspects, Inodevalues, etc. (lsLarge catalog To see this value increase)
cached-- cache, for files that have been opened
Note
??? Total=used+free
??? Used=buffers+cached (maybe add shared also)
The second line describes the memory usage of the application:
previous value = -buffers/cache-- memory size used by applications, used minus cache value
+buffers/cache-- Span style= "font-family: Arial" > All the memory sizes available to the application, free plus cache value
Note:
??-buffers/cache= Used-buffers-cached
?? +buffers/cache=free+buffers+cached
The third row represents swap
used-- used
free-- not used
manual execution sync command ( description : Sync command run sync sub-routine. If you must stop the system, run sync command to ensure file system integrity. sync command writes all the non-writable system buffers to disk, containing the modified I-node , deferred block I/o and read-write map file )
[[email protected]? Test] #?echo?3?>?/proc/sys/vm/drop_caches
[[email protected]? Test] #?cat?/proc/sys/vm/drop_caches
3?
????????????????????????????
! Set the /proc/sys/vm/drop_caches value to 3
??
about /proc/sys/vm/drop_caches the usage is explained below
/proc/sys/vm/drop_caches (since Linux 2.6.16)
Writing to this file causes the kernel to drop clean caches,
Dentries and inodes from memory, causing the memory to become
Free.
To free Pagecache with use echo 1 >/proc/sys/vm/drop_caches; To
Free dentries and inodes, use echo 2 >/proc/sys/vm/drop_caches;
To free Pagecache, dentries and inodes, use echo 3 >
/proc/sys/vm/drop_caches.
Because This is a non-destructive operation and dirty objects
[Go] Manually release Linux memory--/proc/sys/vm/drop_caches