cache释放:
To free pagecache:
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
说明,释放前最好sync一下,防止丢数据。
附:
linux cache内存释放bash 脚本
#! /bin/sh freemem=$(cat /proc/meminfo | grep "MemFree" | awk ‘{print $2}‘) if [ $freemem -le 40 ] then date >> /var/log/mem.log free -m >> /var/log/mem.log sync sync echo 3 > /proc/sys/vm/drop_caches free -m >> /var/log/mem.log fi
时间: 2024-10-22 03:41:14