Skip to content

1.安装

yum install epel-release
yum install smem
yum install epel-release
yum install smem

2.查看

bash
 smem -t -r  | head -20
 
  PID User     Command                         Swap      USS      PSS      RSS 
12035 postgres postgres: startup   recover        0   120800  5012485 10186640 
12047 postgres postgres: checkpointer             0   104684  4995433 10115820 
12032 postgres /usr/pgsql-11.7/bin/postgre        0   510344   664110  1054460 
28643 postgres postgres: inofa greenerp201        0   433236   512166   773388 
27838 postgres postgres: inofa greenerp201        0    19568   282248   914964 
27462 postgres postgres: inofa greenerp201        0    19820   279398   913364 
27913 postgres postgres: inofa greenerp201        0    10812   271796   906096 
12048 postgres postgres: background writer        0      168    68658   264096 
27139 postgres postgres: inofa greenerp201        0    26880    67974   229700
 smem -t -r  | head -20
 
  PID User     Command                         Swap      USS      PSS      RSS 
12035 postgres postgres: startup   recover        0   120800  5012485 10186640 
12047 postgres postgres: checkpointer             0   104684  4995433 10115820 
12032 postgres /usr/pgsql-11.7/bin/postgre        0   510344   664110  1054460 
28643 postgres postgres: inofa greenerp201        0   433236   512166   773388 
27838 postgres postgres: inofa greenerp201        0    19568   282248   914964 
27462 postgres postgres: inofa greenerp201        0    19820   279398   913364 
27913 postgres postgres: inofa greenerp201        0    10812   271796   906096 
12048 postgres postgres: background writer        0      168    68658   264096 
27139 postgres postgres: inofa greenerp201        0    26880    67974   229700

如果完全不包括共享部分的内存,可以看上面“USS”列显示的内存。

最后把几类内存的名词解释一下:

  • VSS- Virtual Set Size 虚拟内存(包含共享库占用的内存)
  • RSS- Resident Set Size 实际使用物理内存(包含共享库占用的内存)
  • PSS- Proportional Set Size 实际使用的物理内存(比例分配共享库占用的内存)
  • USS- Unique Set Size 进程独自占用的物理内存(不包含共享库占用的内存)