public override byte[] TakeBuffer(int bufferSize) { Fx.Assert(bufferSize >= 0, "caller must ensure a non-negative argument"); BufferPool bufferPool = FindPool(bufferSize); if (bufferPool != null) { byte[] buffer = bufferPool.Take(); if (buffer != null) { bufferPool.DecrementCount(); return(buffer); } if (bufferPool.Peak == bufferPool.Limit) { bufferPool.Misses++; if (++totalMisses >= maxMissesBeforeTuning) { TuneQuotas(); } } return(InternalBufferManager.AllocateByteArray(bufferPool.BufferSize)); } else { return(InternalBufferManager.AllocateByteArray(bufferSize)); } }
public override byte[] TakeBuffer(int bufferSize) { return(InternalBufferManager.AllocateByteArray(bufferSize)); }