C# get memory size

public int GetMemorySizeIntMB()
{
System.Diagnostics.Process currentProc = System.Diagnostics.Process.GetCurrentProcess();

try
{
//for 32 bit versions
int x = (currentProc.PrivateMemorySize / 1024);
return x;

}
catch
{
long x = (currentProc.PrivateMemorySize64 / 1024);
return parse.int(x);
}

return 0;
}

  1. No comments yet.
  1. No trackbacks yet.

Leave a comment