Process[] processes = Process.GetProcesses();
long totalMemery = 0;
StringBuilder sbResult = new StringBuilder();
foreach (Process process in processes)
{
sbResult.AppendFormat("名称:{0} 内存大小:{1}KB \n", process.ProcessName, process.PrivateMemorySize64 / 1024);
totalMemery += process.PrivateMemorySize64 / 1024;
}
string result = string.Format("进程总数 {0} 个,共占内存:{1}MB \n", processes.Length, totalMemery / 1024)
+ sbResult.ToString();
MessageBox.Show(result);
===================
使用这个方法,获取到内存与[任务管理器]里面获取到的内存,不一致,怎么获取到和[任务管理器]里一致的数据??
三国纷争
慕妹3242003
相关分类