/// <summary> /// 取得剩餘的記憶體(未使用) Available Physical Memory /// </summary> /// <returns></returns> public static Int64 GetPhysicalAvailableMemoryInMiB() { WinApi.PerformanceInformation pi = new WinApi.PerformanceInformation(); if (WinApi.GetPerformanceInfo(out pi, Marshal.SizeOf(pi))) { return(Convert.ToInt64((pi.PhysicalAvailable.ToInt64() * pi.PageSize.ToInt64() / 1048576))); } else { return(-1); } }
public static extern bool GetPerformanceInfo([Out] out WinApi.PerformanceInformation PerformanceInformation, [In] int Size);