Пример #1
0
 public static IntPtr Allocate(ulong size)
 {
     if (OperatingSystem.IsWindows())
     {
         return(MemoryManagementWindows.Allocate((IntPtr)size));
     }
     else if (OperatingSystem.IsLinux() || OperatingSystem.IsMacOS())
     {
         return(MemoryManagementUnix.Allocate(size));
     }
     else
     {
         throw new PlatformNotSupportedException();
     }
 }
Пример #2
0
        public static IntPtr Allocate(ulong size)
        {
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                IntPtr sizeNint = new IntPtr((long)size);

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