Exemplo n.º 1
0
 private void Dispose(bool disposing)
 {
     if (_handleCache != null)
     {
         for (int i = 0; i < _handleCache.Length; i++)
         {
             SafeHeapHandle handle = _handleCache[i];
             _handleCache[i] = null;
             if (handle != null && disposing)
             {
                 handle.Dispose();
             }
         }
     }
 }
 private void Dispose(bool disposing)
 {
     if (this._handleCache != null)
     {
         for (int i = 0; i < this._handleCache.Length; i++)
         {
             SafeHeapHandle safeHeapHandle = this._handleCache[i];
             this._handleCache[i] = null;
             if (safeHeapHandle != null && disposing)
             {
                 safeHeapHandle.Dispose();
             }
         }
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Give a HeapHandle back for potential reuse
        /// </summary>
        public void Release(SafeHeapHandle handle)
        {
            if (handle.ByteLength <= _maxSize)
            {
                for (int i = 0; i < _handleCache.Length; i++)
                {
                    // Push the handles down, walking the last one off the end to keep
                    // the top of the "stack" fresh
                    handle = Interlocked.Exchange(ref _handleCache[i], handle);
                    if (handle == null) return;
                }
            }

            handle.Dispose();
        }
 public void Release(SafeHeapHandle handle)
 {
     if (handle.ByteLength <= this._maxSize)
     {
         for (int i = 0; i < this._handleCache.Length; i++)
         {
             handle = Interlocked.Exchange <SafeHeapHandle>(ref this._handleCache[i], handle);
             if (handle == null)
             {
                 return;
             }
         }
     }
     handle.Dispose();
 }
Exemplo n.º 5
0
        /// <summary>
        /// Give a HeapHandle back for potential reuse
        /// </summary>
        public void Release(SafeHeapHandle handle)
        {
            if (handle.ByteLength <= _maxSize)
            {
                for (int i = 0; i < _handleCache.Length; i++)
                {
                    // Push the handles down, walking the last one off the end to keep
                    // the top of the "stack" fresh
                    handle = Interlocked.Exchange(ref _handleCache[i], handle);
                    if (handle == null)
                    {
                        return;
                    }
                }
            }

            handle.Dispose();
        }