Run the top and free commands in CentOS to view the idle memory in the system.
The following describes how to 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.