Linux system memory Usage experience

Source: Internet
Author: User
Tags memory usage

Today because to explain the size of the available memory in the system, with Google to see a half-day, there is a Guan Tian in the CU, the competition has not found a better chapter, it is estimated that a lot of people did not notice, understand the later and not sorted out.

In the CU read a lot of articles said memory leak and Linux memory management is not good, the fact is because of the ignorance of Linux memory management caused by misunderstanding.

In the evening I see these days, with some of their own ideas, the experiment summed up for your reference, if there is any mistake please point out directly, while thanking the wiki forum unknown author and he wrote the FAQ Linux Memory Management.

Linux memory management, in fact, with Windows memory management has a very similar place, are using the concept of virtual memory, said here have to scold MS, why in many times there is a lot of physical memory, but still used to pagefile. So I often have to argue with a bunch of people about the size of the pagefile, and how to allocate this problem, in Linux we will not have to fight any swap size problem, I personally think, swap set a 512M is enough, if you ask the 512M swap is not enough to do? Can only say eldest brother you still add memory, or check your application, is not really appear memory leak.

The night is also deep, will not say nonsense.

View memory under Linux We generally use command free

[Root@nonamelinux ~]# Free

Total used free shared buffers Cached

mem:386024 377116 8908 0 21280 155468

-/+ buffers/cache:200368 185656

swap:393552 0 393552

The following is an explanation of these values:

Second line (MEM):

Total: The amount of physical memory.

Used: How big it has been used.

Free: How many are available.

Shared: The total amount of memory shared by multiple processes.

Buffers/cached: The size of the disk cache.

Third line (-/+ buffers/cached):

Used: How big it has been used.

Free: How many are available.

The line four is not much explained.

Difference:

The difference between the used/free of the second line (MEM) and the third row (-/+ Buffers/cache) used/free.

The difference between the two is that the first line is from the OS point of view, because for os,buffers/cached is used, so his available memory is 8908KB, the used memory is 377116KB, which includes, the kernel (OS) uses + Application (X, oracle,etc) used by +buffers+cached.

The third line refers to the application from the point of view of the application, buffers/cached is equal to available, because buffer/cached is to improve the performance of file read, when the application needs to use memory, the buffer/cached will be quickly recycled.

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.