I have the following shell script that I've been using in previous versions of Ubuntu (<= 11.04) to clear memory cache and it has worked fine:

sudo sync && sudo sysctl -w vm.drop_caches=3 && sudo sysctl -w vm.drop_caches=0

I have a new clean install of 11.10 with 3.0.0-12-generic kernel and I get the following error when running the same script script:

vm.drop_caches = 3

error: "Invalid argument" setting key "vm.drop_caches"

有帮助吗?

解决方案

Documentation/sysctl/vm.txt:

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

You can't setting this to zero.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top