How to view linux idle and occupied memory

Source: Internet
Author: User

How to view the idle and occupied linux memory in Linux we usually use the free command, you can also add the-m parameter, in MB as the unit of display. By default, the value of this parameter is kb. [Root @ scs-2 tmp] # free total used free shared buffers cached Mem: 3266180 3250004 16176 0 110652-/+ buffers/cache: 2668236 471116 Swap: 2048276 80160 1968116 the following is an explanation of these values in the Linux memory command: total physical memory size. Used: used. Free: available. Shared: The total memory Shared by multiple processes. Buffers/cached: disk cache size. Row 3 (-/+ buffers/cached): used. Free: available. The fourth line won't be explained much. Difference: used/free of the second row (mem) differs from used/free of the third row (-/+ buffers/cache. The difference between the two is that from the perspective of usage, the first line is from the OS perspective, because for OS, buffers/cached is used, so its available memory is 16176KB, the memory used is kb, including the + buffers + cached used by the kernel (OS) + Application (X, oracle, etc. the third line indicates that, from the application perspective, for applications, buffers/cached is equivalent to available, because buffer/cached is designed to improve file read performance, when the application needs to use the memory, buffer/cached will be quickly recycled. This is why when we run the free command to view the idle memory of the machine, we find that the free value is very small. This is mainly because there is such an idea in linux, the memory does not need to be white, so it tries its best to cache and buffer some data for the next use. But in fact, these memories can also be used immediately. Therefore, from the application perspective, the available memory (idle memory) = system free memory + buffers + cached = system total memory-system used memory: 2795064 = 16176 + 110652 + 2668236 next I will explain when the memory will be exchanged, and by which party to exchange. When the available memory is less than the rated value, a meeting will be held for exchange. Supplement 1 Linux view MEMORY command when viewing rating cat/proc/meminfo [root @ scs-2 tmp] # cat/proc/meminfo also not recommended to view/proc/kcore to determine the memory size, this value is not accurate. The kcore file refers to the space that can be allocated by the kernel, but according to the experiment, this is not the case. It also prompts that in 64-bit OS, the maximum file size can reach 128 TB, because the maximum addressing memory range of 64-bit OS is limited to 128 TB. [Root @ scs-2 tmp] # ll-h/proc/kcore-r -------- 1 root 4.1G Jun 12/proc/kcore Supplement 2 how to produce see the size of memory occupied by a process measure the memory occupied by a process, linux provides us with a very convenient method. The/proc Directory provides us with all the information. In fact, top and other tools also use this to obtain the relevant information. The memory usage information of the/proc/meminfo machine/proc/pid/maps pid indicates the process number and displays the virtual address occupied by the current process. Memory occupied by/proc/pid/statm Process

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.