CentOS memory release

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.