Exemple #1
0
        internal void AddFinalizedObject(IPyDisposable obj)
        {
            if (!Enable)
            {
                return;
            }

#if FINALIZER_CHECK
            lock (_queueLock)
#endif
            {
                this._objQueue.Enqueue(obj);
            }
        }
Exemple #2
0
        internal void AddFinalizedObject(IPyDisposable obj)
        {
            if (!Enable)
            {
                return;
            }
            if (Runtime.Py_IsInitialized() == 0)
            {
                // XXX: Memory will leak if a PyObject finalized after Python shutdown,
                // for avoiding that case, user should call GC.Collect manual before shutdown.
                return;
            }
#if FINALIZER_CHECK
            lock (_queueLock)
#endif
            {
                _objQueue.Enqueue(obj);
            }
            GC.ReRegisterForFinalize(obj);
            if (!_pending && _objQueue.Count >= Threshold)
            {
                AddPendingCollect();
            }
        }
Exemple #3
0
 public FinalizationException(string message, IPyDisposable disposable, Exception innerException)
     : base(message, innerException)
 {
     this.Disposable = disposable ?? throw new ArgumentNullException(nameof(disposable));
 }