Bug 196051

Summary: memory problem in Konqueror
Product: [Applications] konqueror Reporter: m.wege
Component: generalAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED WORKSFORME    
Severity: normal CC: adawit, bugs.kde.org, diplosarus, frank78ac, hduc7721, martin.kampas+kdebugs, rasasi78
Priority: NOR    
Version: 4.9.2   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:

Description m.wege 2009-06-11 17:26:32 UTC
Version:           4.2.90 (KDE 4.2.90 (KDE 4.3 Beta2)) (using 4.2.90 (KDE 4.2.90 (KDE 4.3 Beta2)), Kubuntu packages)
Compiler:          cc
OS:                Linux (i686) release 2.6.30-020630rc6-generic

There seems to be a memory problem in Konqueror. How to reproduce. Open 15+x tabs in Konqueror containing content. Choose those close all tabs execpt one, buy going to "other tabs"-> cloose other tabs. Apart from taking very long (which is allready reported as bug) and eating more then 50% cpu power, only a small amont of the memory is freed after closing all the tabs. In my example Konqueror used about 300MB memory with 15+x tabs, after closing Konqui still uses 279,5MB. I also had the situation where after closing Konqui still used 990MB Ram with one tab left open.
Comment 1 Frank Reininghaus 2009-06-11 20:55:00 UTC
Thanks for the report! I think this is at least partly due to memory fragmentation and therefore very hard to fix, see pages 5 and 6 in 

http://www.google.com/googlebooks/chrome/

for an explanation.
Comment 2 m.wege 2009-06-12 01:28:12 UTC
That is bad. I believe it has become worse from KDE 4.2->4.3 Beta1->4.3 Beta 2. At least from Beta 1 to Beta 2 I am quite sure.
May I suggest a workaround for the situation: Close all but one tab. Kill Konqueror and restart it loading the remaining tab. That should be much faster and clear the memory then.
Comment 3 m.wege 2009-07-16 15:56:35 UTC
The bug is still existing in RC2 and I believe it also affects Akregator. I am not sure, its just a feeling, but may be the bug is caused by nspluginviewer, which also seems to consume a lot of memory when the problem is there.
Comment 4 Martin Kampas 2011-01-23 13:09:42 UTC
The same behavior for me. I also use the workaround described in comment #2 -- this usually frees *much* more than 1GB RAM.. Note that I have not enabled plugins by default and it is rare that I am viewing a page with plugins loaded.
Comment 5 Jonathan M Davis 2011-09-01 10:15:06 UTC
If you close a bunch of tabs and then reopen them with ctrl-z, they don't appear to reload. So, my guess would be that the tabs aren't actually freed at all - or that at least a good chunk of it is kept around - in order to facilitate restoring the tab quickly. And while Konqueror will ask whether you want to "discard changes" when closing a tab with form data filled in, if you close the tab and then do ctrl-z, the form data is back again.

So, it looks like Konqueror is being overly conservative in retaining closed tabs, and I'd argue that it while it might be desirable for Konqueror to keep a few of the most recently closed tabs open in the background so that ctrl-z actually restores the tab as it was, it shouldn't be keeping more than a few. If you browse with 10+ tabs and are constantly opening and closing them and the like, the memory consumption doesn't really drop much, and it continues to go up. So, they really should fix it so that Konqueror only keeps a few tabs after closing them and not _all_ of them.
Comment 6 Dawit Alemayehu 2011-12-22 01:38:41 UTC
Someone will need to post the detailed information for the Konqueror process from ksysguard: Press CTRL+ESC, (In reply to comment #5)
> If you close a bunch of tabs and then reopen them with ctrl-z, they don't
> appear to reload. So, my guess would be that the tabs aren't actually freed at
> all - or that at least a good chunk of it is kept around - in order to
> facilitate restoring the tab quickly. And while Konqueror will ask whether you
> want to "discard changes" when closing a tab with form data filled in, if you
> close the tab and then do ctrl-z, the form data is back again.
> 
> So, it looks like Konqueror is being overly conservative in retaining closed
> tabs, and I'd argue that it while it might be desirable for Konqueror to keep a
> few of the most recently closed tabs open in the background so that ctrl-z
> actually restores the tab as it was, it shouldn't be keeping more than a few.
> If you browse with 10+ tabs and are constantly opening and closing them and the
> like, the memory consumption doesn't really drop much, and it continues to go
> up. So, they really should fix it so that Konqueror only keeps a few tabs after
> closing them and not _all_ of them.

Konqueror does not keep tabs around so that it can restore them. It retains some data it needs to restore the tab in memory, but it most definitely closes the tab (as in delete it) completely. Did any of you correctly measure by how much the memory is increased and then decreased when you open and close a tab ?  Also what does the details of ksysguard (CTRL+ESC) say about the memory being used by Konqueror ?
Comment 7 Martin Kampas 2011-12-22 10:00:24 UTC
Here are two logs - for Webkit and KHTML - of what `ps -O rss,vsz` reports.

With Webkit:

10:03:41 Start a new process - introduction page is shown

RSS/VSZ: 100528/161156

10:04:45 Open a new tab - now we have two tabs: intro page and about:blank

RSS/VSZ: 113044/204776

10:05:54 Close the newly open tab - now we have the introduction page only

RSS/VSZ: 113308/204908

10:06:22 Open a new tab - now we have two tabs again: intro and about:blank

RSS/VSZ: 113308/205040

10:06:44 Close the newly open tab - now we have the introduction page only

RSS/VSZ: 113572/205040
10:16:13 (Idle for some time)
RSS/VSZ: 113804/205212

10:16:26 Open a new tab and navigate to www.kde.org - now we have two tabs

RSS/VSZ: 132548/261964

10:17:35 Close the www.kde.org tab - now we have the introduction page only

RSS/VSZ: 131884/252992

10:18:23 Open a number of new tabs for www.kde.org, www.google.com,
www.kernel.org, www.slashdot.org and www.opendesktop.org

RSS/VSZ: 194304/422992

10:20:59 Close all but the very first tab - now we have only the intro page

RSS/VSZ: 169404/362528

With KHTML:

10:44:43 Start a new process - introduction page is shown

RSS/VSZ: 103340/163156

10:47:29 Open a new tab - now we have two tabs: the intro page and about:blank

RSS/VSZ: 106332/165808

10:47:49 Close the newly open tab - now we have the introduction page only

RSS/VSZ: 106380/165712

10:48:07 Open a new tab - now we have two tabs again: intro and about:blank

RSS/VSZ: 106380/166024

10:48:22 Close the newly open tab - now we have the introduction page only

RSS/VSZ: 106380/166024

10:48:34 Open a new tab and navigate to www.kde.org - now we have two tabs

RSS/VSZ: 148100/215108

10:49:39 Close the www.kde.org tab - now we have the introduction page only

RSS/VSZ: 130476/197252

10:49:51 Open a number of new tabs for www.kde.org, www.google.com, 
www.kernel.org, www.slashdot.org and www.opendesktop.org

RSS/VSZ: 198900/290216

10:51:07 Close all but the very first tab - now we have only the intro page

RSS/VSZ: 178136/269436
Comment 8 Dawit Alemayehu 2011-12-22 17:45:47 UTC
Sorry but relying on RSS and VSZ output from ps to determine memory usage is frankly useless and wrong. See 

http://linux-mm.org/ActualMemoryFootprint OR
http://blogs.kde.org/node/1445 OR 
ttp://lists.kde.org/?t=131272257100002&r=1&w=2 

if you want to understand why. What I need is measurements from ksysguard, which you can launch with CTRL+ESC if you are using KDE. Then

1.) Right click on the specific process (in this case konqueror)
2.) Select "Detailed Memory Information". 

That gives you a very nice and as an accurate information consumption of the given process as possible.

(In reply to comment #7)
> Here are two logs - for Webkit and KHTML - of what `ps -O rss,vsz` reports.
> 
> With Webkit:
> 
> 10:03:41 Start a new process - introduction page is shown
> 
> RSS/VSZ: 100528/161156
> 
> 10:04:45 Open a new tab - now we have two tabs: intro page and about:blank
> 
> RSS/VSZ: 113044/204776
> 
> 10:05:54 Close the newly open tab - now we have the introduction page only
> 
> RSS/VSZ: 113308/204908
> 
> 10:06:22 Open a new tab - now we have two tabs again: intro and about:blank
> 
> RSS/VSZ: 113308/205040
> 
> 10:06:44 Close the newly open tab - now we have the introduction page only
> 
> RSS/VSZ: 113572/205040
> 10:16:13 (Idle for some time)
> RSS/VSZ: 113804/205212
> 
> 10:16:26 Open a new tab and navigate to www.kde.org - now we have two tabs
> 
> RSS/VSZ: 132548/261964
> 
> 10:17:35 Close the www.kde.org tab - now we have the introduction page only
> 
> RSS/VSZ: 131884/252992
> 
> 10:18:23 Open a number of new tabs for www.kde.org, www.google.com,
> www.kernel.org, www.slashdot.org and www.opendesktop.org
> 
> RSS/VSZ: 194304/422992
> 
> 10:20:59 Close all but the very first tab - now we have only the intro page
> 
> RSS/VSZ: 169404/362528
> 
> With KHTML:
> 
> 10:44:43 Start a new process - introduction page is shown
> 
> RSS/VSZ: 103340/163156
> 
> 10:47:29 Open a new tab - now we have two tabs: the intro page and about:blank
> 
> RSS/VSZ: 106332/165808
> 
> 10:47:49 Close the newly open tab - now we have the introduction page only
> 
> RSS/VSZ: 106380/165712
> 
> 10:48:07 Open a new tab - now we have two tabs again: intro and about:blank
> 
> RSS/VSZ: 106380/166024
> 
> 10:48:22 Close the newly open tab - now we have the introduction page only
> 
> RSS/VSZ: 106380/166024
> 
> 10:48:34 Open a new tab and navigate to www.kde.org - now we have two tabs
> 
> RSS/VSZ: 148100/215108
> 
> 10:49:39 Close the www.kde.org tab - now we have the introduction page only
> 
> RSS/VSZ: 130476/197252
> 
> 10:49:51 Open a number of new tabs for www.kde.org, www.google.com, 
> www.kernel.org, www.slashdot.org and www.opendesktop.org
> 
> RSS/VSZ: 198900/290216
> 
> 10:51:07 Close all but the very first tab - now we have only the intro page
> 
> RSS/VSZ: 178136/269436

(In reply to comment #7)
> Here are two logs - for Webkit and KHTML - of what `ps -O rss,vsz` reports.
> 
> With Webkit:
> 
> 10:03:41 Start a new process - introduction page is shown
> 
> RSS/VSZ: 100528/161156
> 
> 10:04:45 Open a new tab - now we have two tabs: intro page and about:blank
> 
> RSS/VSZ: 113044/204776
> 
> 10:05:54 Close the newly open tab - now we have the introduction page only
> 
> RSS/VSZ: 113308/204908
> 
> 10:06:22 Open a new tab - now we have two tabs again: intro and about:blank
> 
> RSS/VSZ: 113308/205040
> 
> 10:06:44 Close the newly open tab - now we have the introduction page only
> 
> RSS/VSZ: 113572/205040
> 10:16:13 (Idle for some time)
> RSS/VSZ: 113804/205212
> 
> 10:16:26 Open a new tab and navigate to www.kde.org - now we have two tabs
> 
> RSS/VSZ: 132548/261964
> 
> 10:17:35 Close the www.kde.org tab - now we have the introduction page only
> 
> RSS/VSZ: 131884/252992
> 
> 10:18:23 Open a number of new tabs for www.kde.org, www.google.com,
> www.kernel.org, www.slashdot.org and www.opendesktop.org
> 
> RSS/VSZ: 194304/422992
> 
> 10:20:59 Close all but the very first tab - now we have only the intro page
> 
> RSS/VSZ: 169404/362528
> 
> With KHTML:
> 
> 10:44:43 Start a new process - introduction page is shown
> 
> RSS/VSZ: 103340/163156
> 
> 10:47:29 Open a new tab - now we have two tabs: the intro page and about:blank
> 
> RSS/VSZ: 106332/165808
> 
> 10:47:49 Close the newly open tab - now we have the introduction page only
> 
> RSS/VSZ: 106380/165712
> 
> 10:48:07 Open a new tab - now we have two tabs again: intro and about:blank
> 
> RSS/VSZ: 106380/166024
> 
> 10:48:22 Close the newly open tab - now we have the introduction page only
> 
> RSS/VSZ: 106380/166024
> 
> 10:48:34 Open a new tab and navigate to www.kde.org - now we have two tabs
> 
> RSS/VSZ: 148100/215108
> 
> 10:49:39 Close the www.kde.org tab - now we have the introduction page only
> 
> RSS/VSZ: 130476/197252
> 
> 10:49:51 Open a number of new tabs for www.kde.org, www.google.com, 
> www.kernel.org, www.slashdot.org and www.opendesktop.org
> 
> RSS/VSZ: 198900/290216
> 
> 10:51:07 Close all but the very first tab - now we have only the intro page
> 
> RSS/VSZ: 178136/269436
Comment 9 Martin Kampas 2011-12-22 20:20:49 UTC
(In reply to comment #8)
Yes I am aware of those issues. What I didn't know was ksysguard could do anything more clever :-)

To be sure I do not waste time, please specify what concrete information (if not all) from ksysguard would you like to see? In which form? Are you interested in similar step-by-step report as that I originally sent? Do you want report for both Webkit and KHTML case? etc..
Comment 10 Dawit Alemayehu 2012-01-04 16:56:00 UTC
> (In reply to comment #8)
> Yes I am aware of those issues. What I didn't know was ksysguard could do
> anything more clever :-)
> 
> To be sure I do not waste time, please specify what concrete information (if
> not all) from ksysguard would you like to see? In which form? Are you
> interested in similar step-by-step report as that I originally sent? Do you
> want report for both Webkit and KHTML case? etc..

See what the "Summary" section says and also what is being shown in the the "Library Usage" section, especially the heap usage section. I think a comparison of how much memory was in use after launching Konqueror and after using it for a while should give you some idea as to its memory usage pattern.
Comment 11 m.wege 2012-10-26 07:45:34 UTC
The problem continues to exist with Konqueror and Akregator in 4.92
Comment 12 henry 2014-04-19 13:54:45 UTC
I want to confirm that Konqueror has this problem. It is interesting this is still flagged as "unconfirmed"
We are now in 2014.
My system: Opensuse 13.1 KDE 4.12.4
I began noticing a problem when google begins to request that I fill a captcha due to unusual network activities detected from my side. This was finally traced to Konqueror, I used Konqueror sporadically, mainly out of curiosity to see how well it compares to firefox (please don't burn me at the stakes :-))

Scenario: open konqueror, surf the net a bit. Close Konqueror. Open firefox. Perform a search on google. Google complains about unusual network activities. Check running processes (remember konqueror was just closed), konqueror still running in memory. Kill konqueror. Perform a search on google. This time no captcha.

IMHO Konqueror has a problem.
Comment 13 Christoph Feck 2014-05-04 17:34:48 UTC
Please add the information requested in comment #10. But I still think it is simply the heap not shrinking, not actually a memory leak.
Comment 14 henry 2014-05-04 18:01:24 UTC
As requested Konqueror memory usage stats:
Just opened Konqueror=============================================================
The process konqueror (with pid 18328) is using approximately 44.4 MB of memory.
It is using 39.3 MB privately, 115.3 KB for pixmaps, and a further 41.7 MB that is, or could be, shared with other programs.
Dividing up the shared memory between all the processes sharing that memory we get a reduced shared memory usage of 5.0 MB. Adding that to the private and pixmap usage, we get the above mentioned total memory footprint of 44.4 MB.
Library Usage

The memory usage of a process is found by adding up the memory usage of each of its libraries, plus the process's own heap, stack and any other mappings. 
Private
more
33228 KB	[heap]
4328 KB	/usr/lib64/libkhtml.so.5.13.0
732 KB	/usr/lib64/libkdeinit4_konqueror.so
280 KB	/usr/lib64/libkjs.so.4.13.0
120 KB	/usr/lib64/kde4/searchbarplugin.so
Shared
more
9144 KB	/usr/lib64/libnvidia-glcore.so.331.49
5272 KB	/SYSV00000000 (deleted)
4244 KB	/usr/lib64/libQtGui.so.4.8.5
1840 KB	/usr/lib64/libQtWebKit.so.4.10.3
1836 KB	/usr/lib64/libkdeui.so.5.13.0

Displaying Home Page=================================================================
Process 18328 - konqueror

Summary

The process konqueror (with pid 18328) is using approximately 66.6 MB of memory.
It is using 58.4 MB privately, 136.6 KB for pixmaps, and a further 51.6 MB that is, or could be, shared with other programs.
Dividing up the shared memory between all the processes sharing that memory we get a reduced shared memory usage of 8.1 MB. Adding that to the private and pixmap usage, we get the above mentioned total memory footprint of 66.6 MB.
Library Usage

The memory usage of a process is found by adding up the memory usage of each of its libraries, plus the process's own heap, stack and any other mappings, plus the stack of its 8 threads. 
Private
more
50888 KB	[heap]
4412 KB	/usr/lib64/libkhtml.so.5.13.0
980 KB	/usr/lib64/libQtWebKit.so.4.10.3
748 KB	/usr/lib64/libkdeinit4_konqueror.so
328 KB	/usr/lib64/kde4/kwebkitpart.so
Shared
more
10256 KB	/usr/lib64/libQtWebKit.so.4.10.3
9144 KB	/usr/lib64/libnvidia-glcore.so.331.49
5272 KB	/SYSV00000000 (deleted)
4460 KB	/usr/lib64/libQtGui.so.4.8.5
1848 KB	/usr/lib64/libkdeui.so.5.13.0

After a search on google=============================================================
Process 18328 - konqueror

Summary

The process konqueror (with pid 18328) is using approximately 103.2 MB of memory.
It is using 92.4 MB privately, 96.3 KB for pixmaps, and a further 59.5 MB that is, or could be, shared with other programs.
Dividing up the shared memory between all the processes sharing that memory we get a reduced shared memory usage of 10.7 MB. Adding that to the private and pixmap usage, we get the above mentioned total memory footprint of 103.2 MB.
Library Usage

The memory usage of a process is found by adding up the memory usage of each of its libraries, plus the process's own heap, stack and any other mappings, plus the stack of its 13 threads. 
Private
more
78540 KB	[heap]
4412 KB	/usr/lib64/libkhtml.so.5.13.0
4320 KB	/usr/lib64/browser-plugins/libflashplayer.so
2276 KB	/usr/lib64/libQtWebKit.so.4.10.3
756 KB	/usr/lib64/libkdeinit4_konqueror.so
Shared
more
10568 KB	/usr/lib64/libQtWebKit.so.4.10.3
9144 KB	/usr/lib64/libnvidia-glcore.so.331.49
5272 KB	/SYSV00000000 (deleted)
4572 KB	/usr/lib64/libQtGui.so.4.8.5
1932 KB	/usr/lib64/libkdeui.so.5.13.0

After closing Konqueror===============================================================
Process 18328 - konqueror

Summary

The process konqueror (with pid 18328) is using approximately 85.3 MB of memory.
It is using 74.5 MB privately, 96.3 KB for pixmaps, and a further 59.6 MB that is, or could be, shared with other programs.
Dividing up the shared memory between all the processes sharing that memory we get a reduced shared memory usage of 10.7 MB. Adding that to the private and pixmap usage, we get the above mentioned total memory footprint of 85.3 MB.
Library Usage

The memory usage of a process is found by adding up the memory usage of each of its libraries, plus the process's own heap, stack and any other mappings, plus the stack of its 13 threads. 
Private
more
56004 KB	[heap]
4412 KB	/usr/lib64/libkhtml.so.5.13.0
4320 KB	/usr/lib64/browser-plugins/libflashplayer.so
4208 KB	[stack:20339]
2288 KB	/usr/lib64/libQtWebKit.so.4.10.3
Shared
more
10656 KB	/usr/lib64/libQtWebKit.so.4.10.3
9144 KB	/usr/lib64/libnvidia-glcore.so.331.49
5272 KB	/SYSV00000000 (deleted)
4584 KB	/usr/lib64/libQtGui.so.4.8.5
1932 KB	/usr/lib64/libkdeui.so.5.13.0
Comment 15 diplosarus 2015-08-15 08:34:34 UTC
The problem continues to exist in 4.14.10 also konqueror still fails to exit after closing the window, as described abvoe.
Comment 16 diplosarus 2015-08-15 08:52:24 UTC
also this apears to be a duplicate of Bug 257012
Comment 17 Justin Zobel 2022-10-17 00:40:55 UTC
Thank you for reporting this bug in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "CONFIRMED" when replying. Thank you!
Comment 18 henry 2022-10-19 21:02:22 UTC
Since I have stopped using Konqueror, I am unable to provide any 
information.

Thanks.

On 10/16/22 20:40, Justin Zobel wrote:
> https://bugs.kde.org/show_bug.cgi?id=196051
>
> Justin Zobel <justin.zobel@gmail.com> changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>           Resolution|---                         |WAITINGFORINFO
>               Status|REPORTED                    |NEEDSINFO
>
> --- Comment #17 from Justin Zobel <justin.zobel@gmail.com> ---
> Thank you for reporting this bug in KDE software. As it has been a while since
> this issue was reported, can we please ask you to see if you can reproduce the
> issue with a recent software version?
>
> If you can reproduce the issue, please change the status to "CONFIRMED" when
> replying. Thank you!
>
Comment 19 Bug Janitor Service 2022-11-03 05:06:17 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 20 Bug Janitor Service 2022-11-18 05:16:33 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!