static Transaction() { Windows.MEMORYSTATUSEX statEX = new Windows.MEMORYSTATUSEX(); statEX.dwLength = 2 * 4 + 7 * 8; Windows.GlobalMemoryStatusEx(ref statEX); // .Min in case machine has >80 GB! which would overflow an integer. Actually limits to 500MB regardless (that seems plenty!) MAXIMUMMEMORY = (int)Math.Min(500000000, statEX.ullTotalPhys / 20); // new Microsoft.VisualBasic.Devices.ComputerInfo().TotalPhysicalMemory }