Article Title: fast: manually release Linux server memory. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
When you use free-m to view the server memory during server running, it is often found that the free value is very small, and some students are very nervous and always want to take some measures, so that the free value looks a little higher, it is a bit better. In fact, I personally think this is just a quick time and has no substantive purpose.
I. Volkswagen memory release method
1. First use free-m to view the remaining memory
View plaincopy to clipboardprint?
Linux-8v2i :~ # Free-m
Total used free shared buffers cached
Mem: 3952 2773 178 0 130 1097
-/+ Buffers/cache: 1545 2406
Swap: 2055 0 2055
Linux-8v2i :~ # Free-m
Total used free shared buffers cached
Mem: 3952 2773 178 0 130 1097
-/+ Buffers/cache: 1545 2406
Swap: 2055 0 2055
2. Run the sync command.
Use the sync command to ensure the integrity of the file system. Run the sync command to run the sync subroutine and write all unwritten system buffers to the disk, contains modified I-node, delayed block I/O, and read/write ing files.
View plaincopy to clipboardprint?
Linux-8v2i :~ # Sync
Linux-8v2i :~ # Sync
3. Modify/proc/sys/vm/drop_caches
View plaincopy to clipboardprint?
Echo 3>/proc/sys/vm/drop_caches
Echo 3>/proc/sys/vm/drop_caches
Note:
1>./proc is a virtual file system. We can use its read/write operations as a means of communication with the kernel object. In other words, you can modify the file in/proc to adjust the current kernel behavior. In other words, we can adjust/proc/sys/vm/drop_caches to release the memory.
2>. Official descriptions of drop_caches are as follows:
Writing to this file causes the kernel to drop clean caches, dentries and inodes from memory, causing that memory to becomefree.
To free pagecache, 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 are not freeable, the user shocould run sync first.
3>. the Linux kernel caches the recently accessed file pages in the memory for a period of time. This File Cache is called pagecache.
[1] [2] Next page