Figure quick: manually release Linux Server Memory

Source: Internet
Author: User
Article Title: fast: manually release Linux server memory. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

When you use free-m to view the server memory during server running, it is often found that the free value is very small, and some students are very nervous and always want to take some measures, so that the free value looks a little higher, it is a bit better. In fact, I personally think this is just a quick time and has no substantive purpose.

  I. Volkswagen memory release method

1. First use free-m to view the remaining memory

View plaincopy to clipboardprint?

Linux-8v2i :~ # Free-m

Total used free shared buffers cached

Mem: 3952 2773 178 0 130 1097

-/+ Buffers/cache: 1545 2406

Swap: 2055 0 2055

Linux-8v2i :~ # Free-m

Total used free shared buffers cached

Mem: 3952 2773 178 0 130 1097

-/+ Buffers/cache: 1545 2406

Swap: 2055 0 2055

2. Run the sync command.

Use the sync command to ensure the integrity of the file system. Run the sync command to run the sync subroutine and write all unwritten system buffers to the disk, contains modified I-node, delayed block I/O, and read/write ing files.

View plaincopy to clipboardprint?

Linux-8v2i :~ # Sync

Linux-8v2i :~ # Sync

3. Modify/proc/sys/vm/drop_caches

View plaincopy to clipboardprint?

Echo 3>/proc/sys/vm/drop_caches

Echo 3>/proc/sys/vm/drop_caches

Note:

1>./proc is a virtual file system. We can use its read/write operations as a means of communication with the kernel object. In other words, you can modify the file in/proc to adjust the current kernel behavior. In other words, we can adjust/proc/sys/vm/drop_caches to release the memory.

2>. Official descriptions of drop_caches are as follows:

Writing to this file causes the kernel to drop clean caches, dentries and inodes from memory, causing that memory to becomefree.

To free pagecache, use echo 1>/proc/sys/vm/drop_caches;

To free dentries and inodes, use echo 2>/proc/sys/vm/drop_caches;

To free pagecache, dentries and inodes, use echo 3>/proc/sys/vm/drop_caches.

Because this is a non-destructive operation and dirty objects are not freeable, the user shocould run sync first.

3>. the Linux kernel caches the recently accessed file pages in the memory for a period of time. This File Cache is called pagecache.

[1] [2] Next page

Related Article

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.