Virt:
1Process"Required"Virtual Memory size, including the database used by the process,Code, Data, andMalloc,NewAllocated heap space and allocated stack space;
2If the process has a new application10 MBMemory, but actually only used1 MB, It will increase10 MBInstead of the actual1 MBUsage.
3,Virt = swap + Res
Res:
1The memory size currently used by the process, includingMalloc,NewAllocated heap space and allocated stack space, but not includingSwap outQuantity;
2, Including sharing of other processes;
3If you apply10 MBMemory, actually used1 MB, It only grows1 MB, AndVirtOpposite;
4Only the memory occupied by the loaded library files is counted.
5,Res = code + Data
SHR:
1In addition to the shared memory of its own processes, it also includes the shared memory of other processes;
2, Although the process only uses several shared library functions, it contains the size of the entire shared library;
3Formula for Calculating the physical memory occupied by a process:Res-SHR;
4,Swap outIt will be downgraded.
Example
# Include <iostream>
Int main ()
{
Char * P = new char [1024*1024*512];
Getchar ();
Return 0;
}
Top:
PID user PR Ni virt res shr s % CPU % mem time + command
401 hhhhh 17 0 523 M 916 s 792 0.0. 00./main
Original article:
Http://blog.csdn.net/huyiyang2010/article/details/7815491