private static void CheckForAvailableMemory(out ulong availPageFile, out ulong totalAddressSpaceFree) { Win32Native.MEMORYSTATUSEX memorystatusex = default(Win32Native.MEMORYSTATUSEX); if (!Win32Native.GlobalMemoryStatusEx(ref memorystatusex)) { __Error.WinIOError(); } availPageFile = memorystatusex.availPageFile; totalAddressSpaceFree = memorystatusex.availVirtual; }
private static void CheckForAvailableMemory(out ulong availPageFile, out ulong totalAddressSpaceFree) { Win32Native.MEMORYSTATUSEX buffer = new Win32Native.MEMORYSTATUSEX(); if (!Win32Native.GlobalMemoryStatusEx(ref buffer)) { __Error.WinIOError(); } availPageFile = buffer.availPageFile; totalAddressSpaceFree = buffer.availVirtual; }
[System.Security.SecurityCritical] // auto-generated private static void CheckForAvailableMemory(out ulong availPageFile, out ulong totalAddressSpaceFree) { bool r; Win32Native.MEMORYSTATUSEX memory = new Win32Native.MEMORYSTATUSEX(); r = Win32Native.GlobalMemoryStatusEx(memory); if (!r) { __Error.WinIOError(); } availPageFile = memory.availPageFile; totalAddressSpaceFree = memory.availVirtual; //Console.WriteLine("Memory gate: Mem load: {0}% Available memory (physical + page file): {1} MB Total free address space: {2} MB GC Heap: {3} MB", memory.memoryLoad, memory.availPageFile >> 20, memory.availVirtual >> 20, GC.GetTotalMemory(true) >> 20); }
private static void CheckForAvailableMemory(out ulong availPageFile, out ulong totalAddressSpaceFree) { bool r; Win32Native.MEMORYSTATUSEX memory = new Win32Native.MEMORYSTATUSEX(); r = Win32Native.GlobalMemoryStatusEx(ref memory); if (!r) { throw Win32Marshal.GetExceptionForLastWin32Error(); } availPageFile = memory.availPageFile; totalAddressSpaceFree = memory.availVirtual; // Console.WriteLine($"Memory gate: Mem load: {memory.memoryLoad}% Available memory (physical + page file): {(memory.availPageFile >> 20)} MB Total free address space: {memory.availVirtual >> 20} MB GC Heap: {(GC.GetTotalMemory(true) >> 20)} MB"); }