double usedMemory = 0;
Process p = Process.GetProcesses().Where(x => x.ProcessName.Contains("进程名")).FirstOrDefault();
if (p != null)
{
p.Refresh();
string procName = p.ProcessName;
using (PerformanceCounter pc = new PerformanceCounter("Process", "Working Set - Private", procName))
{
usedMemory = pc.NextValue() / 1024.0 / 1024.0;
}
}