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)
Lets say I have a process running in the back ground, Java.exe, it is allowed to use 1024mb of ram, how can I tell how much ram it is currently using.
I am starting the process myself, so I have access to the Process object, I would just like a little more clarification on what property is the one for me.
All computer memory is connected to the CPU and RAM. However, the high memory usage problem is mainly due to the overcrowding of many internal processes. Therefore, it helps to stop the unnecessary programs and applications that are running. Open the Task Manager and check any extra programs you aren't using.
Press Ctrl + Shift + Esc to launch Task Manager. Or, right-click the Taskbar and select Task Manager. Select the Performance tab and click Memory in the left panel. The Memory window lets you see your current RAM usage, check RAM speed, and view other memory hardware specifications.
Check Computer Memory Usage EasilyTo open up Resource Monitor, press Windows Key + R and type resmon into the search box. Resource Monitor will tell you exactly how much RAM is being used, what is using it, and allow you to sort the list of apps using it by several different categories.
I found this on msdn and it is working
System.Diagnostics.Process proc = ...; // assign your process here :-) int memsize = 0; // memsize in KB PerformanceCounter PC = new PerformanceCounter(); PC.CategoryName = "Process"; PC.CounterName = "Working Set - Private"; PC.InstanceName = proc.ProcessName; memsize = Convert.ToInt32(PC.NextValue()) / (int)(1024); PC.Close(); PC.Dispose();
If you are purely interested in physical memory, you probably want WorkingSet64, which gives "the amount of physical memory allocated for the associated process." Understand that this value constantly fluctuates, and the value this call gives you may not be up to date. You may also be interested in PeakWorkingSet64, which gives "the maximum amount of physical memory used by the associated process."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With