CentOS memory release
Last week, a friend asked me why the company's server memory free was 0, which meant where the memory went. This caused a small discussion, that is, the issue of memory release...
First, we may use free to check the memory usage. It should be like this.
[Root @ ipython ~] # Free-m total used free sharedbuffers cachedMem: 3204031707332049827649-/+ buffers/cache: 355928480 Swap: 16087016087 # In fact, after a process ends, its memory will be released, however, the kernel does not immediately collect the memory to free, but stores it in cache or buffers to improve the system's IO efficiency. The cache and buffered memory are dynamically configured and managed by the kernel, if the system's free size is not enough, the system will automatically release the cache buffer memory for the program! #### Proof: if used occupies a lot of resources, free is very small, and the proportion of cache and buffer is small, it indicates that the memory is not enough ##
Of course, if you still need to see more free, you can try this way.
1. Use the sync command to write to disk all the unwritten system cache regions, including modified I nodes, delayed block I \ O, and read/write ing [root @ ipython ~] # Sync2, brute force cleanup [root @ ipython ~] # Cat/proc/sys/vm/drop_caches0 # The default value is 0, drop_caches provides three option operations #1 clear page cache 2 clear inode and directory tree cache 3 clear all caches # Clear cache pages # [root @ ipython ~] # Echo "1">/proc/sys/vm/drop_caches # Let's take a look # [root @ ipython ~] # Free-m total used free sharedbuffers cachedMem: 32040 25642947500 40-/+ buffers/cache: 252429515 Swap: 16087016087