I have been having some trouble figuring out how exactly I get a process\'s ram usage. (How much ram it is currently consuming, not how much is reserved, or its max or min)<
great, I wanted this to get the same as depicted in task manager,and tried:
Process.PrivateMemorySize64
Process.PeakVirtualMemorySize64
Process.PeakPagedMemorySize
Process.PagedSystemMemorySize64
Process.PagedMemorySize64
Process.NonpagedSystemMemorySize64
Process.WorkingSet64
and none of those worked but Performance Counter does !
PerformanceCounter PC = new PerformanceCounter();
PC.CategoryName = "Process";
PC.CounterName = "Working Set - Private";
PC.InstanceName = "processNameHere";
memsize = Convert.ToInt32(PC.NextValue()) / (int)(1024);
PC.Close();
PC.Dispose();
thanks a lot !