Ejemplo n.º 1
0
 public void Dispose()
 {
     if (_marker != IntPtr.Zero)
     {
         ProfilerUnsafeUtility.EndSample(_marker);
     }
 }
        public void End()
        {
#if ENABLE_PROFILER
            // Early out as soon as possible if profiler disabled
            if (!PlayerConnectionProfiler.Enabled)
            {
                return;
            }
            ProfilerUnsafeUtility.EndSample(m_Ptr);
#endif
        }
Ejemplo n.º 3
0
        private static void CreateInternal(ref DisposeSentinel sentinel, int callSiteStackDepth)
        {
            NativeLeakDetectionMode mode = NativeLeakDetection.Mode;
            bool flag = mode == NativeLeakDetectionMode.Disabled;

            if (!flag)
            {
                ProfilerUnsafeUtility.BeginSample(DisposeSentinel.s_CreateProfilerMarkerPtr);
                StackTrace stackTrace = null;
                bool       flag2      = mode == NativeLeakDetectionMode.EnabledWithStackTrace;
                if (flag2)
                {
                    stackTrace = new StackTrace(callSiteStackDepth + 2, true);
                }
                sentinel = new DisposeSentinel
                {
                    m_StackTrace = stackTrace,
                    m_IsCreated  = 1
                };
                ProfilerUnsafeUtility.EndSample(DisposeSentinel.s_CreateProfilerMarkerPtr);
            }
        }
Ejemplo n.º 4
0
 protected override void Finalize()
 {
     try
     {
         bool flag = this.m_IsCreated != 0;
         if (flag)
         {
             string filename   = "";
             int    linenumber = 0;
             ProfilerUnsafeUtility.BeginSample(DisposeSentinel.s_LogErrorProfilerMarkerPtr);
             bool flag2 = this.m_StackTrace != null;
             if (flag2)
             {
                 string str   = StackTraceUtility.ExtractFormattedStackTrace(this.m_StackTrace);
                 string msg   = "A Native Collection has not been disposed, resulting in a memory leak. Allocated from:\n" + str;
                 bool   flag3 = this.m_StackTrace.FrameCount != 0;
                 if (flag3)
                 {
                     filename   = this.m_StackTrace.GetFrame(0).GetFileName();
                     linenumber = this.m_StackTrace.GetFrame(0).GetFileLineNumber();
                 }
                 UnsafeUtility.LogError(msg, filename, linenumber);
             }
             else
             {
                 string msg2 = "A Native Collection has not been disposed, resulting in a memory leak. Enable Full StackTraces to get more details.";
                 UnsafeUtility.LogError(msg2, filename, linenumber);
             }
             ProfilerUnsafeUtility.EndSample(DisposeSentinel.s_LogErrorProfilerMarkerPtr);
         }
     }
     finally
     {
         base.Finalize();
     }
 }
Ejemplo n.º 5
0
        public static unsafe void EndSample()
        {
#if ENABLE_PROFILER
            ProfilerUnsafeUtility.EndSample(ProfilerProtocolThread.Stream.markerStack.PopMarker());
#endif
        }
 public void End()
 {
     ProfilerUnsafeUtility.EndSample(this.m_Ptr);
 }
        public void End()
        {
#if ENABLE_PROFILER
            ProfilerUnsafeUtility.EndSample(m_Ptr);
#endif
        }
 public void Dispose()
 {
     ProfilerUnsafeUtility.EndSample(m_Ptr);
 }