Exemplo n.º 1
0
        public override bool allocate()
        {
            NativeMemoryUtils.init();

            memorySize = MemoryMap.END_RAM + 1;
            memory     = new long[System.Math.Max((memorySize + pageSize - 1) >> pageShift, 1)];
            for (int i = 0; i < memory.Length; i++)
            {
                memory[i] = NativeMemoryUtils.alloc(pageSize);
                if (memory[i] == 0)
                {
                    // Not enough native memory available
                    for (int j = 0; j < i; j++)
                    {
                        NativeMemoryUtils.free(memory[j]);
                    }
                    return(false);
                }
            }

//JAVA TO C# CONVERTER TODO TASK: The following line has a Java format specifier which cannot be directly translated to .NET:
//ORIGINAL LINE: Console.WriteLine(String.format("Using SparseNativeMemory(littleEndian=%b)", NativeMemoryUtils.isLittleEndian()));
            Console.WriteLine(string.Format("Using SparseNativeMemory(littleEndian=%b)", NativeMemoryUtils.LittleEndian));

            return(base.allocate());
        }
Exemplo n.º 2
0
        public override bool allocate()
        {
            NativeMemoryUtils.init();

            memorySize = MemoryMap.END_RAM + 1;
            memory     = NativeMemoryUtils.alloc(memorySize);

            if (memory == 0)
            {
                // Not enough native memory available
                return(false);
            }

//JAVA TO C# CONVERTER TODO TASK: The following line has a Java format specifier which cannot be directly translated to .NET:
//ORIGINAL LINE: Console.WriteLine(String.format("Using NativeMemory(littleEndian=%b)", NativeMemoryUtils.isLittleEndian()));
            Console.WriteLine(string.Format("Using NativeMemory(littleEndian=%b)", NativeMemoryUtils.LittleEndian));

            return(base.allocate());
        }