Release cache buff/cache under Linux

Under Linux, you often encounter the problem of excessive buff/cache memory usage, especially when using cloud hosts. Many domains are virtual memory, so if the buff/cache takes up too much, the free space memory is very small. Affect;

The usual memory relationships are:

Ordinary machine: total=used+free

Virtual machine: total=used+free+buff/cache

For example, if you use Aliyun cloud host, it is total=used+free+buff/cache

At this time, you can see that the memory occupied by buff/cache is very large.

At this time, you can use the command to clear the cache memory

echo 1 > /proc/sys/vm/drop_caches

echo 2 > /proc/sys/vm/drop_caches

echo 3 > /proc/sys/vm/drop_caches

The value of drop_caches can be a number between 0-3, representing different meanings: 0: Do not release (system default value) 1: Release page cache 2: Release dentries and inodes 3: Release all caches

In general, executing echo 1 can release most of the cache space!

Reference article: https://zhuanlan.zhihu.com/p/459398220

おすすめ

転載: blog.csdn.net/A_captain_608/article/details/128844040
おすすめ