These days found that CentOS system memory has been up, even if the Apache and MySQL closed, memory is not released, you can use the following script to free memory:
Script content:
Copy Code code as follows:
#! /bin/bash
# Cache Release:
# to free Pagecache:
Sync
Sync
#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
Use System crontab to achieve automatic daily operation:
Copy Code code as follows:
Enter the following content:
Copy Code code as follows:
Free memory at 0 per day, which can be modified to suit your needs.
If you are prompted for an error when running./cached.sh: Permission denied permissions, you can run:
Copy Code code as follows:
In addition, you can modify the/etc/sysctl.conf method to achieve the purpose of automatically releasing the cache. But not enough memory, it is best to look for other reasons, such as whether the program settings are reasonable, whether the burst traffic is very large, or the program is not reasonable to cause memory overflow, after all, the operating system itself design will consider all aspects of the problem, forced to vacate the size of the cache, may just put the problem to the temporary It is not conducive to judging the problem.