Release Ubuntu/linux system cache to increase available memory space

Source: Internet
Author: User
View Memory usage Commands

Free Memory Command

 释放kernel用在cache上面的内存 sudo sysctl -w vm.drop_caches=3释放无论是使用中的内存还是cache(page cache, inodes, and dentries),但可能会影响系统的稳定!sudo sync && echo 3 | sudo tee /proc/sys/vm/drop_caches定时清理内存I. 建一个脚本freecache.sh查看一下内存使用情况,找到内存所在行。判断可用内存大小,如果小于300M,就释放内存。drop_caches文件中就一个0,这里为什么要写入一个3呢?官方解释如下: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.freecache.shIconfree -m |grep -i mem |awk ‘{if($4 < 300){ printf("3") > "/proc/sys/vm/drop_caches"}}‘;II.加到catontab中去sudo sucrontab -e*/05 * * * * /home/zhangying/free.sh //每5分钟执行一次

Release Ubuntu/linux system cache to increase available memory space

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.