private static void Allocate(int length, Allocator allocator, out NativeArray <T> array) { long num = (long)UnsafeUtility.SizeOf <T>() * (long)length; NativeArray <T> .CheckAllocateArguments(length, allocator, num); array = default(NativeArray <T>); array.m_Buffer = UnsafeUtility.Malloc(num, UnsafeUtility.AlignOf <T>(), allocator); array.m_Length = length; array.m_AllocatorLabel = allocator; array.m_MinIndex = 0; array.m_MaxIndex = length - 1; DisposeSentinel.Create(out array.m_Safety, out array.m_DisposeSentinel, 1, allocator); NativeArray <T> .InitStaticSafetyId(ref array.m_Safety); }