Ejemplo n.º 1
0
 public static bool Decommit(IntPtr address, ulong size)
 {
     if (OperatingSystem.IsWindows())
     {
         return(MemoryManagementWindows.Decommit(address, (IntPtr)size));
     }
     else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS())
     {
         return(MemoryManagementUnix.Decommit(address, size));
     }
     else
     {
         throw new PlatformNotSupportedException();
     }
 }
Ejemplo n.º 2
0
        public static bool Decommit(IntPtr address, ulong size)
        {
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                IntPtr sizeNint = new IntPtr((long)size);

                return(MemoryManagementWindows.Decommit(address, sizeNint));
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ||
                     RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                return(MemoryManagementUnix.Decommit(address, size));
            }
            else
            {
                throw new PlatformNotSupportedException();
            }
        }