How to release cache memory in Linux?

To release cache memory, you can use the following methods:

  1. To use the sync command: the sync command can write data from the cache to the hard drive and release the associated memory. Enter the following command in the terminal:
sync
  1. 使用echo命令清理缓存:可以通过echo命令向/proc/sys/vm/drop_caches文件中写入数值来清理缓存。可以在终端中输入以下命令:
echo 1 > /proc/sys/vm/drop_caches  #清理页面缓存
echo 2 > /proc/sys/vm/drop_caches  #清理目录项和inode缓存
echo 3 > /proc/sys/vm/drop_caches  #清理页面、目录项和inode缓存
  1. You can use the free command to check the system’s memory usage, including cache and buffer. Just input the following command in the terminal:
free -h
  1. Reboot system: If the above methods do not work, you can try restarting the system to free up cached memory.

Please be aware that releasing cached memory may impact system performance, as caches can improve read and write speeds. These operations should only be performed when memory needs to be freed up.

 

 

More tutorials

How to check if an array is not empty in PHP?(Opens in a new browser tab)

What are the steps for configuring environment variables in CentOS 7?(Opens in a new browser tab)

How to clear the cache in Tomcat with Spring Boot?(Opens in a new browser tab)

How to clear yum cache command on Linux?(Opens in a new browser tab)

How to handle a large number of concurrent read and write requests in Cassandra?(Opens in a new browser tab)

How to implement cache expiration mechanism in Redis?(Opens in a new browser tab)

How can I utilize PhotoRec to retrieve erased files?(Opens in a new browser tab)

How to check the process corresponding to a port number in Linux?(Opens in a new browser tab)

convert string to character array in Java.(Opens in a new browser tab)

Leave a Reply 0

Your email address will not be published. Required fields are marked *