Run the top and free commands in CentOS to view the idle memory in the system.

Source: Internet
Author: User
The following describes how to use the top and free commands to view the free memory in the system. Therefore, if you run the top command, you can see [root @ linuxzgf ~]. # TopMem: 8174492 ktotal, 7124268 kused, does not mean that your application has used 7.1 of the memory, which includes: application memory + buffer + cache memory, you need to run the free command. the following is an example (unit: MB): [ro: use the top and free commands to view idle memory in the system.

So what you see when you run the top command
[Root @ linuxzgf ~] # Top

Mem: 8174492 k total, 7124268 k used, does not mean that your application has used 7.1 of the memory, which 7.1G includes: for application memory + buffer + cache memory, you need to use the free command to view.

The following is an example (unit: MB ):

[Root @ linuxzgf ~] # Free-m
Total used free shared buffers cached
Mem: 7982 6811 1171 0 350 5114
-/+ Buffers/cache: 1346 6636
Swap: 16935 11 16924
[Root @ linuxzgf ~] #
In this example, the application only uses MB of memory and MB of idle memory.

Some simple calculation methods:

Physical memory used = actual memory used-buffer-cache

= 6811 M-350 M-5114 M

Physical idle memory = total physical memory-actually used memory + buffer + cache

Available idle memory for applications = total physical memory-actually used memory

Application memory used = actual memory used-buffer-cache


Original explanation: transfer to Internet:
The basic principle of Linux is that no resources should be wasted. therefore, the core uses as much RAM as possible to cache information from local and remote file systems. when the system performs read/write operations, data related to the currently running process is stored in RAM as much as possible. the cache of the system report is the sum of cache and page cache. the cache is not recycled at the end of the process (you may soon start another process and need the same data), but recycled as needed-for example, when you start a process that requires a large amount of memory, the Linux core recycles the cache from the memory and allocates the obtained memory to the new process.

Some areas, such as anonymous memory ing (MMP) and shared memory areas, are reported as cache, but not directly released by the core. the general cache does not map to the address space of the process, but is just a simple core ing, and these special caches map to all processes attached to them.
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.