Linux 释放没用的内存

3/8/2017来源:ASP.NET技巧人气:1849

Free up unused memory:[1][2]

sudo sysctl -w vm.drop_caches=3 #This command will clear pagecache: /sbin/sysctl vm.drop_caches=1 #To clear dentries and inodes you can use: /sbin/sysctl vm.drop_caches=2 #To free memory of the all above use a following command: /sbin/sysctl vm.drop_caches=3

或者

sudo sync && echo 3 | sudo tee /PRoc/sys/vm/drop_caches

Check memory usage:[3]

free -m

例子输出

total used free shared buffers cached Mem: 15983 4957 11025 153 44 808 -/+ buffers/cache: 4105 11877 Swap: 16318 585 15733