How to clean up system memory in GNU/Linux
/*************************************** ******************************* Author: samson * Date: 04/21/2015 * Test platform: * gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2 * GNU bash, 4.3.11 (1)-release (x86_64-pc-linux-gnu) **************************************** ****************************/
After opening a lot of programs that will occupy the memory, close these programs and find that the memory space is the same as that used when the application is not closed, as a result, when other applications open the memory is not enough or very card, then you want to clear the memory occupied by the previous program open, and most of the memory is occupied by the cache data, so how to clean up the memory? You can use the following steps to clean up the memory:
In most GNU Linux, the cache mechanism is enabled by default. If the configuration file cat/proc/sys/vm/drop_caches is 0, the cache mechanism is enabled, this mechanism is very effective when a service is always running, so that the service itself can be quickly read. As a desktop user, the opened program is not so simple, therefore, it is recommended that you set this configuration file to 1 to clean up the system cache and release the space for other programs.
1. memory usage before cleanup
Free-h
2. Start cleaning
Echo 1>/proc/sys/vm/drop_caches
3. memory usage after cleaning
Free-h
Drop_caches indicates that the system clears the cache of the Memory Page to obtain more available memory.