Exemplo n.º 1
0
 public void Free(T[][] data)
 {
     lock (_bufferManager)
     {
         _bufferManager.Free(data);
     }
 }
        private void AllocAndFree(IBufferManager <byte> manager)
        {
            var alloc = Enumerable.Range(1, Allocations);

            Parallel.ForEach(alloc, (i) => {
                var buffer = manager.Allocate(BufferSize);
                manager.Free(buffer);
            });
        }
Exemplo n.º 3
0
        private void AllocAndFree(IBufferManager <byte> manager)
        {
            var alloc = Enumerable.Range(1, Allocations).Select(i => manager.Allocate(BufferSize)).ToArray();

            foreach (var a in alloc)
            {
                manager.Free(a);
            }
        }
        private int DecreaseReferenceInternal()
        {
            var ret = Interlocked.Decrement(ref _references);

            if (ret == 0 && !object.ReferenceEquals(_data, EmptyArray))
            {
                _bufferManager.Free(_data);
                _data = null;
            }

            return(ret);
        }