Linux releases memory

Source: Internet
Author: User
Kernels2.6.16andnewerprovideamechanismtohavethekerneldropthepagecacheand/orinodeanddentrycachesoncommand, whichcanhelpfreeupalotofmemory ....

Kernels 2.6.16 and newer provide a mechanic to have the kernel drop the page cache and/or inode and dentry caches on command, which can help free up a lot of memory. now you can throw away that script that allocated a ton of memory just to get rid of the cache...

To use/proc/sys/vm/drop_caches, just echo a number to it.

To free pagecache:
Echo 1>/proc/sys/vm/drop_caches

To free dentries and inodes:
Echo 2>/proc/sys/vm/drop_caches


To free pagecache, dentries and inodes:
Echo 3>/proc/sys/vm/drop_caches


This is a non-destructive operation and will only free things that are completely unused. dirty objects will continue to be in use until written out to disk and are not freeable. if you run "sync" first to flush them out to disk, these drop operations will tend to free more memory.

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.