Release Ubuntu/linux system cache to increase available memory space

Source: Internet
Author: User

A desktop Ubuntu memory is 3G, but free has only 200M of memory and cannot meet the needs of Scala's JVM.

Note Use the top command to see the true free memory. Here's another command to see how much memory is actually used.

    1. Watch-n 1 Cat/proc/meminfo

Search found that there are three ways to achieve the purpose of freeing memory:

    1. Watch-n 1 free-m
    2. Or
    3. Free-m

The above method only increased by dozens of M.

    1. sudo sysctl-w vm.drop_caches=3

The purpose of this method is to release the memory that kernel uses on the cache. increased by about 1G.

The following method releases more, but may affect the stability of the system! Be sure to use it carefully.

    1. sudo sync && echo 3 | sudo tee/proc/sys/vm/drop_caches

This command releases either the memory in use or the cache (page cache, inodes, and Dentries), which is used with care.

In general, the second approach is more appropriate, and cron jobs can be used if it takes time to run automatically at intervals.

Release Ubuntu/linux system cache to increase available memory space

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.