`
duyouhua1214
  • 浏览: 228272 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

清理内存

    博客分类:
  • Unix
 
阅读更多

flushcase.sh:


echo "vm.drop_caches = 1" > /etc/sysctl.conf
#sysctl -p


while [ 1 ]
do

free_size=$(free | grep "Mem"  | awk '{print $4}')

if [ "$free_size" -le "32768" ]
then
 sync
 #date
 #echo stb current free size=$free_size
 echo 1 > /proc/sys/vm/drop_caches
fi

sleep 1

done


#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

分享到:
评论
发表评论

文章已被作者锁定,不允许评论。

相关推荐

Global site tag (gtag.js) - Google Analytics