private void RemoveOverflownBufferEntriesIfAllowed() { if (!RemoveOverflownEntries) { return; } while (_numRows > _maxNumRows) { OutputEntry entry = _entries.Peek(); // Remove entry only if it is completely hidden from view. if (_numRows - entry.Lines.Count >= _maxNumRows) { _numRows -= entry.Lines.Count; _entries.Dequeue(); _entryPool.Release(entry); } else { break; } } }