[Konsole-devel] [Bug 176974] High memory consumption when using Konsole for a longer time.
Michael Meier
mick22 at gmx.at
Mon Jun 8 21:14:31 UTC 2009
https://bugs.kde.org/show_bug.cgi?id=176974
--- Comment #36 from Michael Meier <mick22 gmx at> 2009-06-08 23:14:27 ---
#35,
the two approaches share that the format information is extracted from each
character and only stored once for each block of consecutive chars that have
the same attributes. That reduces the amount of space required per line roughly
from 11*n+x to 2*n+x.
The difference is that my current solution does not use one big block but uses
a QList to store a pointer to each line. This makes the implementation rather
straightforward compared to a self-implemented buffer, which would be much more
error-prone. What you basically need is a fixed-size FIFO to store the lines
and that's easily achieved using a QList.
That might not be the most efficient way of storing the history, but it
certainly makes a lot of difference to what there is now.
Konsole currently allocates one big block and puts everything there, but such
an implementation is hard to maintain IMHO. I rather rely on existing data
structures. When the size of the history changes, you have to allocate a new
block and copy everything from the old to the new buffer. During this time, 2
buffers will be on the heap and thus increase the heap size, and there's no
guarantee that this memory will ever be returned to the OS.
There is certainly room for improvement if you want to squeeze out the last
bits:
- convert everything to utf-8 (might save you another 50% in the best case)
- use any kind of compression for character data (e.g. RLE)
- store the actual raw output which was printed to konsole originally and
re-interpret it when you need to paint it...
- etc.
--
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
mailing list