public static int GetMemoryUsage() { var pi = PerformanceInformation.GetCurrent(); return((int)(100 * pi.CommitTotal / pi.PhysicalTotal)); }