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

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