/Proc is a virtual document system. we can use its read/write operations as a means to communicate with the kernel object. that is to say, the current kernel behavior can be adjusted by modifying the documents in/proc. then we can release the memory by adjusting/proc/sys/vm/drop_caches. the procedure is as follows: [Root @ server test] # cat/proc/sys/vm/drop_caches 0 First, the value of/proc/sys/vm/drop_caches. the default value is 0. [Root @ server test] # sync Run the sync command manually (description: the sync command runs the sync subroutine. If the system must be stopped, run the sync command to ensure the integrity of the document system. The sync command writes any unwritten system buffer to the disk, including modified I-nodes, delayed block I/O, and read/write ing documents) [Root @ server test] # echo 3>/proc/sys/vm/drop_caches [Root @ server test] # cat/proc/sys/vm/drop_caches 3 Set/proc/sys/vm/drop_caches to 3 [Root @ server test] # free-m Total used free shared buffers cached Mem: 249 66 182 0 0 11 -/+ Buffers/cache: 55 194 Swap: 511 0 511 Run the free command and find that the current used is 66 MB, free is 182 MB, buffers is 0 MB, and cached is 11 MB. this effectively releases the buffer and cache. The usage of/proc/sys/vm/drop_caches is described 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 that memory to become Free. To free pagecache, use echo 1>/proc/sys/vm/drop_caches; 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 Are not freeable, the user shoshould run sync (8) first. |