- Generally use the free command to display overall memory usage:
The second line from the OS perspective, used includes the memory used by the kernel + application +buffers+cached, buffers/cached is the size of the disk cache
The third line from the application angle, available memory = System Free memory+buffers+cached
- Also available:Cat/proc/meminfo, similar to free, but in more detail:
The explanations are as follows:
memtotal: All available RAM size (that is, physical memory minus some reserved bits and kernel binary code size) Memfree:lowfree and Highfree, the system keeps unused memory buffers: used to buffer the file size cached : The size of memory used by the cache memory (equal to DiskCache minus SwapCache). swapcached: The size of the swap space used by the cache memory has been swapped out Memory, but is still stored in the swapfile. Used to be quickly replaced when needed without having to open the I/o port. Active: The size of the buffer or buffer memory paging file in active use, unless it is necessary to be removed for his use. Inactive: The size of the paging file in infrequently used buffers or cache memory may be used in other ways. Hightotal:highfree: The zone is not mapped directly to the kernel space. The kernel must use this memory in a different manner. Lowtotal:lowfree: Low can achieve the same effect as high memory, and it can be used by the kernel to record some of its own data structures. Among many other things, it's where everything from the Slab is allocated. Bad things happen if you' re out of Lowmem.Swaptotal: The total size of the swap space swapfree: the size of the swap space that is not being used dirty: The amount of memory waiting to be written back to the disk. Writeback: The amount of memory that is being written back to disk. Anonpages: Memory size of unmapped pages mapped: size of mappings such as devices and files. Slab: The size of the kernel data structure cache can reduce the consumption of application and release memory. Sreclaimable: Recoverable slab size Sunreclaim: Non-recoverable slab size (Sunreclaim+Sreclaimable=slab) Pagetables: The size of the index table that manages the paging page of memory. Nfs_unstable: The size of the unstable page table Vmalloctotal: You can vmalloc the virtual memory size vmallocused: The amount of virtual memory that has been used. Vmallocchunk:largest contigious block of Vmalloc area which are free
- View specific process memory conditions:cat/proc/{pid}/STATM
43798 1104 891 148 0 302 0
The outputs are:
Size (pages) task virtual address space VMSIZE/4
Resident (pages) the size of the physical memory that the application is using VMRSS/4
Shared (pages) pages
The size of the executable virtual memory owned by the TRS (pages) program VMEXE/4
The size of the library in which Lrs (pages) is imaged into the virtual memory space of the task VMLIB/4
Drs (pages) program data segment and user-state stack size (vmdata+ VMSTK) 4
DT (pages) 04
Reference article:
Viewing the size of memory in Linux
Linux Memory View