public static MemoryInfo LogMemory() { MemoryInfo MemInfo = new MemoryInfo(); GlobalMemoryStatus(ref MemInfo); double totalMb = MemInfo.TotalPhysical / 1024 / 1024; double avaliableMb = MemInfo.AvailablePhysical / 1024 / 1024; Debug.Log($"物理内存共有:{totalMb}MB"); Debug.Log($"可使用的物理内存:{avaliableMb}MB"); Debug.Log($"剩余内存百分比:{Math.Round((avaliableMb / totalMb) * 100, 2)}"); return(MemInfo); }
public static extern void GlobalMemoryStatus(ref MemoryInfo meminfo);