protected override void Dispose(bool disposing)
        {
            if (_handle == IntPtr.Zero)
            {
                return;
            }

            if (disposing)
            {
                // Clear interop cache

                foreach (var v in _interopCache)
                {
                    if (v is IDisposable dsp)
                    {
                        dsp.Dispose();
                    }
                }

                _interopCache.Clear();
            }

            // free unmanaged resources (unmanaged objects) and override a finalizer below. set large fields to null.

            _resultStack.Dispose();
            _invocationStack.Dispose();

            NeoVM.ExecutionEngine_Free(ref _handle);
        }
Beispiel #2
0
        /// <summary>子类重载实现资源释放逻辑</summary>
        /// <param name="disposing">从Dispose调用(释放所有资源)还是析构函数调用(释放非托管资源)</param>
        protected override void OnDispose(Boolean disposing)
        {
            base.OnDispose(disposing);

            if (disposing)
            {
                // 释放托管资源
                if (_Stock != null)
                {
                    _Stock.Dispose();
                    _Stock = null;
                }
            }

            if (_clearTimers != null)
            {
                _clearTimers.Dispose();
                _clearTimers = null;
            }
        }