private static void Cleanup() { try { if (_global != (IntPtr)0) { _global = (IntPtr)0; } if (_instance != (IntPtr)0) { UnsafeNativeMethods.PerfCloseAppCounters(_instance); _instance = (IntPtr)0; } } catch (Exception e) { Debug.Trace("Perfcounters", "Exception: " + e.StackTrace); } }
override protected bool ReleaseHandle() { UnsafeNativeMethods.PerfCloseAppCounters(handle); handle = IntPtr.Zero; return(true); }