[Konsole-devel] [Bug 176974] High memory consumption when using Konsole for a longer time.
mick22 at gmx.at
Mon Jun 15 10:25:54 UTC 2009
--- Comment #51 from Michael Meier <mick22 gmx at> 2009-06-15 12:25:45 ---
Two buffers are only allocated for multi-color lines. But you even need a total
of three allocations for such lines: one for the actual HistoryLine object and
another two for the two arrays (character data, format). Single color lines
have only character data, so there are only two allocations in total. As we
know now, this stresses the heap quite a lot.
In theory, it would be possible to use mallopt to force mmap allocations also
for small buffers, but without an algorithm to fit multiple lines into one
buffer we would waste a whole page per line. The default size at which glibc
uses mmap for allocations is 1MB.
The general problem with one large buffer is, that you don't know in advance
how much space you need for n lines of variable length. If the user wishes n
lines of history, you would need to estimate how big the buffer must be. If
it's too large, you waste space again. And if it's too small, you must
reallocate+copy and I don't know about the implications on performance of such
A possible solution would be to use a variable-length list of fixed size
buffers that are mmap-allocated. Each buffer contains a variable number of
history lines and once such a buffer fills up, a new one is allocated and added
to the list. If all lines of a buffer are removed from the history, you can
unmap the whole buffer.
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the konsole-devel