Пример #1
0
        public static void Allocate(int capacity, int desiredJobCount, out TransformAccessArray array)
        {
            array.m_TransformArray = TransformAccessArray.Create(capacity, desiredJobCount);
            IntPtr    arg_3F_0 = array.m_TransformArray;
            Allocator arg_3F_1 = Allocator.Persistent;
            int       arg_3F_4 = 1;

            if (TransformAccessArray.< > f__mg$cache0 == null)
            {
                TransformAccessArray.< > f__mg$cache0 = new DisposeSentinel.DeallocateDelegate(TransformAccessArray.DeallocateFromDisposeSentinel);
            }
            DisposeSentinel.Create(arg_3F_0, arg_3F_1, out array.m_Safety, out array.m_DisposeSentinel, arg_3F_4, TransformAccessArray.< > f__mg$cache0);
        }
Пример #2
0
 public static void Create(IntPtr ptr, Allocator label, out AtomicSafetyHandle safety, out DisposeSentinel sentinel, int callSiteStackDepth, DisposeSentinel.DeallocateDelegate deallocateDelegate = null)
 {
     safety = AtomicSafetyHandle.Create();
     if (NativeLeakDetection.Mode == NativeLeakDetectionMode.Enabled)
     {
         sentinel = new DisposeSentinel
         {
             m_StackFrame         = new StackFrame(callSiteStackDepth + 2, true),
             m_Ptr                = ptr,
             m_Label              = label,
             m_DeallocateDelegate = deallocateDelegate,
             m_Safety             = safety
         };
     }
     else
     {
         sentinel = null;
     }
 }
Пример #3
0
        public static DisposeSentinel Create(IntPtr ptr, Allocator label, int callSiteStackDepth, DisposeSentinel.DeallocateDelegate deallocateDelegate = null)
        {
            DisposeSentinel result;

            if (NativeLeakDetection.Mode == NativeLeakDetectionMode.Enabled)
            {
                DisposeSentinel disposeSentinel = new DisposeSentinel();
                StackFrame      stackFrame      = new StackFrame(callSiteStackDepth + 2, true);
                disposeSentinel.m_FileName           = stackFrame.GetFileName();
                disposeSentinel.m_LineNumber         = stackFrame.GetFileLineNumber();
                disposeSentinel.m_Ptr                = ptr;
                disposeSentinel.m_Label              = label;
                disposeSentinel.m_DeallocateDelegate = deallocateDelegate;
                result = disposeSentinel;
            }
            else
            {
                result = null;
            }
            return(result);
        }