The release of Linux server memory seems to improve the efficiency of some people, but the actual work is not very satisfactory. Here we will talk about how to do this job, it helps us better understand how the Linux system works.
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.
4. Use free-m to view the remaining memory as follows:
View plaincopy to clipboardprint?
Linux-8v2i :~ # Free-m
Total used free shared buffers cached
Mem: 3952 1773 2325 0 0 80
-/+ Buffers/cache: 1545 2406
Swap: 2055 0 2055
Linux-8v2i :~ # Free-m
Total used free shared buffers cached
Mem: 3952 1773 2325 0 0 80
-/+ Buffers/cache: 1545 2406
Swap: 2055 0 2055
The release of Linux Server Memory is easy.
- Linux shell script BASICS (1)
- A Brief Introduction to how to obtain the file path of a Linux Process
- Detailed introduction to basic learning of Linux shell scripts 8)
- Security Configuration for Linux system security improvement
- Linux system security improvement-System Optimization