This question is covered here in great detail. 这个问题在这里详细介绍。 html
How do you measure the memory usage of an application or process in Linux? 您如何衡量Linux中应用程序或进程的内存使用状况? linux
From the blog article of Understanding memory usage on Linux , ps
is not an accurate tool to use for this intent. 从了解Linux上的内存使用的博客文章中, ps
不是用于此目的的准确工具。 app
Why
ps
is "wrong" 为何ps
是“错误的” 工具Depending on how you look at it,
ps
is not reporting the real memory usage of processes. 根据您的见解,ps
不会报告进程的实际内存使用状况。 What it is really doing is showing how much real memory each process would take up if it were the only process running . 它的真正做用是显示若是每一个进程是惟一运行的进程 , 则每一个进程将占用多少实际内存。 Of course, a typical Linux machine has several dozen processes running at any given time, which means that the VSZ and RSS numbers reported byps
are almost definitely wrong . 固然,一台典型的Linux计算机在任何给定时间都运行着几十个进程,这意味着ps
报告的VSZ和RSS编号几乎确定是错误的 。 this