コード例 #1
0
ファイル: GC.CoreCLR.cs プロジェクト: Maximys/runtime
            // remove the local function when https://github.com/dotnet/runtime/issues/5973 is implemented
            static T[] AllocateNewUninitializedArray(int length, bool pinned)
            {
                GC_ALLOC_FLAGS flags = GC_ALLOC_FLAGS.GC_ALLOC_ZEROING_OPTIONAL;

                if (pinned)
                {
                    flags |= GC_ALLOC_FLAGS.GC_ALLOC_PINNED_OBJECT_HEAP;
                }

                return(Unsafe.As <T[]>(AllocateNewArray(typeof(T[]).TypeHandle.Value, length, flags)));
            }
コード例 #2
0
ファイル: GC.cs プロジェクト: lvyitian/corert
            static T[] AllocateNewUninitializedArray(int length, bool pinned)
            {
                GC_ALLOC_FLAGS flags = GC_ALLOC_FLAGS.GC_ALLOC_ZEROING_OPTIONAL;

                if (pinned)
                {
                    flags |= GC_ALLOC_FLAGS.GC_ALLOC_PINNED_OBJECT_HEAP;
                }

                if (length < 0)
                {
                    throw new OverflowException();
                }

                T[] array = null;
                RuntimeImports.RhAllocateNewArray(EETypePtr.EETypePtrOf <T[]>().RawValue, (uint)length, (uint)flags, Unsafe.AsPointer(ref array));
                if (array == null)
                {
                    throw new OutOfMemoryException();
                }

                return(array);
            }
コード例 #3
0
ファイル: GC.CoreCLR.cs プロジェクト: Maximys/runtime
 internal static extern Array AllocateNewArray(IntPtr typeHandle, int length, GC_ALLOC_FLAGS flags);