private void ResizeBuffer(int size) { if (size <= BufferPool.BUFFER_CUTOFF) { // Checkout buffer from cache. cluster.GetNextBuffer(size, segment); } else { // Large buffers should not be cached. // Allocate, but do not put back into pool. segment = new BufferSegment(); segment.buffer = new byte[size]; segment.offset = 0; segment.size = size; } }
private void ResizeBuffer() { if (dataLength <= BufferPool.BUFFER_CUTOFF) { // Checkout buffer from cache. dataBuffer = cluster.GetNextBuffer(dataLength); } else { // Large buffers should not be cached. // Allocate, but do not put back into pool. if (dataBuffer != null && dataBuffer.Length <= BufferPool.BUFFER_CUTOFF) { oldDataBuffer = dataBuffer; } dataBuffer = new byte[dataLength]; } }