Last week, a friend asked me that his company's server memory free is 0 why, the meaning is probably where the memory went, which led to a small discussion, that is, the issue of memory release ...
First we may use free to see the memory usage, it should be like this
[[Email protected]~]#Free-M total used free shared buffers CachedMem: 32040 31707 332 0 498 27649-/+ buffers/< Span class= "PLN" >cache: 355928480swap: 16087 0 16087# #实际上在一个进程结束后其内存是会被释放的, but the kernel does not immediately collect the memory into free, but is stored in the cache or buffers, to improve the system's IO efficiency, Cache and buffered memory is a dynamic configuration management by the kernel, if the system free size is not enough, the system will automatically release cache buffer memory for the program to use! ### #证: If used takes up a lot, free is very small, and the cache and buffer ratio is also very low, that indicates that memory is not enough. #
Of course, if you still need to see more free, you can try this
1UseSynccommand to have all the system buffers not writtenWrite to diskthat contains the modifiedI node, blocks that have been deferredI\oand read-Write mappings[[Email protected]~]#Sync2, Rough cleaning[[Email protected]~]#Cat/Proc/Sys/Vm/Drop_caches0# #可以看到默认是0, Drop_caches offers three options operation # #1 Empty page Cache 2 EmptyInodeAnd the directory tree cache 3 Clear all the Caches# #清空缓存页 # #[[Email protected]~]#Echo"1">/proc/Sys/Vm/Drop_caches# #再来看看 # #[[Email protected]~]# free -m total used free shared buffers Cached Mem: 32040 2564 29475 0 0< Span class= "PLN" > 40-/+ Buffers/cache: 252429515swap: 16087 0 16087
» reprint reserved Copyright: It Chen Yi» talk about Linux memory release» This article link address: http://www.ipython.me/centos/linux-memory-release.html» This article copyright take: By-nc-sa Authorization of the Agreement, reproduced in the source. In addition to It-tools, news and special notes, all articles on this site are original. » If you like can: Click here to subscribe to this site
Talk about Linux memory release