Bug 145702

Summary: Increased memory usage when using auto reload on a page
Product: [Applications] konqueror Reporter: Bram Schoenmakers <me>
Component: khtmlAssignee: Konqueror Developers <konq-bugs>
Status: CONFIRMED ---    
Severity: normal CC: finex
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Massif Postscript file
Massif HTML file
Massif output with KDE trunk

Description Bram Schoenmakers 2007-05-20 12:10:52 UTC
Version:           SVN revision 665844 (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 4.1.1 
OS:                Linux

I normally load my Last.fm profile (http://www.last.fm/user/bram85) and enable auto reload on that page to refresh every 5 minutes.

After some time, I suspected that the Konqueror instance used more and more memory. This becomes visible to the eye when you reload such page starting in the morning until late in the evening. Memory usage shows a big drop when I closed that Konqueror instance.

So I ran this scenario in valgrind's massif. And my suspicion was right: KHTML uses more and more memory when doing auto reload. It seems that the number of allocations by allocateChars (ustring.cpp:175) increases in time.

I did also massif tests with Konqueror doing manual reloads with the reload button and no reloading at all. But that did not increase the memory usage over time. 

So it becomes clear the the reload button in Konqueror does something else than the auto reload. It seems that the latter just grabs the URL from the current part and calls openURL() again with that URL. Konqueror does more logic when pressing "Reload", but I couldn't distinct this with calling openURL on the part. Somehow the manual reload triggers KHTML/KJS to clean up some stuff which is not done by just calling openURL, as done by the auto reloader.
Comment 1 Bram Schoenmakers 2007-05-20 12:12:32 UTC
Created attachment 20637 [details]
Massif Postscript file

Massif's result where you can see how the allocated memory by allocateChars
increases.
Comment 2 Bram Schoenmakers 2007-05-20 12:13:32 UTC
Created attachment 20638 [details]
Massif HTML file

Corresponding HTML file (--depth=5).
Comment 3 Bram Schoenmakers 2008-04-21 16:38:43 UTC
Created attachment 24470 [details]
Massif output with KDE trunk

I ran the same test in Konqueror 4 (revision 798759). Attached is the result,
no growing pattern is to be found anymore, each reload takes more or less the
same amount of memory. The only differences compared to the former test is that
I reload every 10 minutes instead of every 5. And I ran this instance for about
30 minutes instead of more than an hour last time.

I haven't tested the KDE 3.5 branch yet, but my impression is that this issue
is still there, concluded from day-to-day use.
Comment 4 Bram Schoenmakers 2008-04-21 22:42:40 UTC
I just produced a similar image as in comment 1 in KDE 3.5 branch r790898.
Comment 5 Justin Zobel 2021-03-21 00:25:13 UTC
Thank you for the bug report.

As this report hasn't seen any changes in 10 years or more, we ask if you can please confirm that the issue still persists.

If this bug is no longer persisting or relevant please change the status to resolved.