Commit ed2a9a9e authored by Carlos Alves's avatar Carlos Alves Committed by Kurt Hindenburg
Browse files

Make CompactHistoryBlock size variable (v21.04.0)

When needed CompactHistoryBlock can now increase from 256kb to a bigger
size.

BUG: 436031
parent 2b441030
......@@ -9,13 +9,19 @@
using namespace Konsole;
CompactHistoryBlock::CompactHistoryBlock() :
_blockLength(4096 * 64), // 256kb
_head(static_cast<quint8 *>(mmap(nullptr, _blockLength, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0))),
constexpr size_t BLOCK_LENGTH = 4096 * 64 ; // 256kb
CompactHistoryBlock::CompactHistoryBlock(size_t blockLength) :
_blockLength(BLOCK_LENGTH),
_tail(nullptr),
_blockStart(nullptr),
_allocCount(0)
{
if (blockLength > _blockLength) {
_blockLength = blockLength;
}
_head = static_cast<quint8 *>(mmap(nullptr, _blockLength, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0));
Q_ASSERT(_head != MAP_FAILED);
_tail = _blockStart = _head;
}
......
......@@ -19,7 +19,7 @@ namespace Konsole
class CompactHistoryBlock
{
public:
CompactHistoryBlock();
CompactHistoryBlock(size_t blockLength = 0);
virtual ~CompactHistoryBlock();
......
......@@ -20,7 +20,7 @@ void *CompactHistoryBlockList::allocate(size_t size)
{
CompactHistoryBlock *block;
if (list.isEmpty() || list.last()->remaining() < size) {
block = new CompactHistoryBlock();
block = new CompactHistoryBlock(size);
list.append(block);
////qDebug() << "new block created, remaining " << block->remaining() << "number of blocks=" << list.size();
} else {
......
......@@ -35,9 +35,9 @@ public:
protected:
CompactHistoryBlockList &_blockListRef;
CharacterFormat *_formatArray;
quint16 _length;
int _length;
uint *_text;
quint16 _formatLength;
int _formatLength;
bool _wrapped;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment