public void Recycle() { BytesPool.Recycle(m_buffer); m_bitsPointer = 0; m_buffer = null; Pool.Recycle(this); }
private void EnsureBufferSpace(int additionalSpaceInBits) { var length = m_buffer.Length; if (m_bitsPointer + additionalSpaceInBits > length << 3) { var tmpBuffer = m_buffer; var newBuffer = BytesPool.Get((int)(length * GrowingFactor) + 1); System.Buffer.BlockCopy(tmpBuffer, 0, newBuffer, 0, tmpBuffer.Length); BytesPool.Recycle(m_buffer); m_buffer = newBuffer; } }