Bug 228037

Summary: Memory leak when using and closing many tabs
Product: [Applications] konsole Reporter: Ariel Garcia <aog2000a>
Component: generalAssignee: Konsole Developer <konsole-devel>
Severity: normal CC: adaptee, mick22
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:

Description Ariel Garcia 2010-02-22 13:14:27 UTC
Version:           4.3.2 (using KDE 4.3.4)
OS:                Linux
Installed from:    Debian testing/unstable Packages

There is a memory leak in konsole which becomes apparent when using many multiple tabs and closing them afterwards: the memory consumption grows!

The usecase is: i work with several (2-4) konsole windows, and open many (say 4 to 10) tabs in them. In most of the tabs i just start ssh sessions. Scroll lines is set to a relatively high value: 50000.
These consoles/tabs stay open for hours-days.

- each time I close one tab the memory consumption increases! 
I've seen the RSS memory size going up from 160M to 208M when closing all minus one open tabs.

- if in this situation i start and immediately close new tabs the memory consumption stays unchanged.

- if in one of the new tabs i 'cat' a big text file (filling up the 50000 lines of history buffer), the memory usage goes up (as expected)

- however if i now close the above tab (with the full history buffer) the memory consumption stays unchanged

(After a fresh start of konsole, the memory usage (RES in top, RSS in ps) is around 20M)

For comparison the output of
   ps axf -eo pid,%mem,rsz,vsz,sz,state,stime,command | grep konsole
having one freshly started konsole (pid 26732) and another one which has been running for 5 days and has seen many (~100?) open tabs and ssh sessions. BUT both currently have only one tab open!

26732  2.2 17176  72616 18154 S 13:10 konsole
25406 29.1 225696 358052 89513 S Feb17 kdeinit4: konsole [kdeinit]

I would expect that the used scrollback buffers get freed when a tab is closed, but most importantly the memory consumption shouldn't get up when closing long-lived tabs!

Please feel free to suggest any other info i should provide/debugging i could perform. Thanks for working on Konsole, it's great :-)

Debian package versions used (testing/unstable as of 2010-02-20):

ii  kdebase-runtime            4:4.3.4-2                  runtime components from the official KDE 4 release
ii  kdelibs5                   4:4.3.4-1                  core libraries for all KDE 4 applications
ii  konsole                    4:4.3.2-1                  X terminal emulator for KDE 4
ii  libc6                      2.10.2-2                   GNU C Library: Shared libraries
ii  libqt4-dbus                4:4.5.3-4                  Qt 4 D-Bus module
ii  libqtcore4                 4:4.5.3-4                  Qt 4 core module
ii  libqtgui4                  4:4.5.3-4                  Qt 4 GUI module
ii  libstdc++6                 4.4.2-9                    The GNU Standard C++ Library v3
ii  libx11-6                   2:1.3.3-1                  X11 client-side library
ii  libxrender1                1:0.9.5-1                  X Rendering Extension client library

Kernel: selfcompiled
Comment 1 Michael Meier 2010-02-26 19:58:16 UTC
This is fixed in 4.4.0.
Comment 2 Ariel Garcia 2010-02-26 20:54:54 UTC
Cool, thanks!

I will test as soon as 4.4 packages are available. Currently testing the version in 4.3.4, but shorter "runs" didn't show the problem yet.
Comment 3 Michael Meier 2010-02-26 22:34:56 UTC
Original bug report here: https://bugs.kde.org/show_bug.cgi?id=176974
Comment 4 Ariel Garcia 2010-02-26 23:28:41 UTC
Thanks for the link Michael.

Sorry i missed the other one when looking for duplicates (or didn't think it was the same issue)
Comment 5 Jekyll Wu 2011-07-31 12:37:11 UTC

*** This bug has been marked as a duplicate of bug 176974 ***