/// <summary> /// Releases RefCounted instances which were finalized (which can happen on any thread) /// </summary> static internal void ReleaseFinalized() { lock (refCountedFinalizerQueue) { foreach (var native in refCountedFinalizerQueue) { NativeCore.RemoveNative(native); NativeCore.csi_AtomicEngine_ReleaseRef(native); } refCountedFinalizerQueue.Clear(); } }
protected virtual void Dispose(bool disposing) { disposed = true; if (refHandle != null && !refHandle.IsInvalid) { NativeCore.RemoveNative(nativeInstance); // Free the handle refHandle.Dispose(); } nativeInstance = IntPtr.Zero; }