Summary: | [PATCH] Gwenview leaks memory in fullscreen mode | ||
---|---|---|---|
Product: | [Applications] gwenview | Reporter: | Benni Hill <benni> |
Component: | general | Assignee: | Gwenview Bugs <gwenview-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | critical | CC: | iaguis, mcv, nucleo |
Priority: | NOR | ||
Version: | 2.8.1 | ||
Target Milestone: | --- | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
Latest Commit: | http://commits.kde.org/gwenview/c2439f20fcabbde514a18389e4718b397bc0bd17 | Version Fixed In: | 2.8.4 |
Sentry Crash Report: | |||
Attachments: |
use insertMulti()
don't overwrite mLastAccess |
Description
Benni Hill
2012-03-19 23:47:21 UTC
I just confirmed this bug with latest git version. Disabling preloading (with exporting GWENVIEW_MAX_UNREFERENCED_IMAGES=0) seems to work around this bug. Created attachment 69795 [details]
use insertMulti()
I think I fixed it.
The problem is that in fullscreen mode the thumbnails at the top often get loaded at the same time (< 1msec difference), so the garbageCollector sees the same mLastAccess for all images and therefore only one image is inserted into the QMap UnreferencedImages. I changed the garbageCollector to use insertMulti(). Please see attached patch and test.
(IMHO overwriting the mLastAccess value by the thumbnail bar won't remove the oldest image from memory?)
Created attachment 69952 [details]
don't overwrite mLastAccess
I found out that the mLastAccess variable is constantly overwritten in DocumentInfoProvider::isModified and DocumentInfoProvider::isBusy.
I changed
DocumentFactory::load(const KUrl& url) to
DocumentFactory::load(const KUrl& url, bool updateLastAccess)
with updateLastAccess=true as default and changed the factory->load(url) call in isModified and isBusy to factory->load(url, false). This seems to solve the problem (in an inelegant way).
As it seems to me that isModified and isBusy just need a pointer to an already loaded image, wouldn't it be better to implement an DocumentFactory::find(const KUrl& url) function which returns a pointer if the url has already been loaded (and hasUrl could be deprecated)? Hi, thanks for the patch! and sorry for the late answer :(. I am looking at your work right now. Git commit c2439f20fcabbde514a18389e4718b397bc0bd17 by Aurélien Gâteau. Committed on 04/05/2012 at 18:21. Pushed by gateau into branch 'KDE/4.8'. Fix leaking documents Documents were never released because DocumentInfoProvider kept loading them. A big thank you to Benni Hill for discovering the bug and proposing the initial patch. FIXED-IN:2.8.4 M +6 -11 app/documentinfoprovider.cpp M +12 -4 lib/document/documentfactory.cpp M +19 -1 lib/document/documentfactory.h http://commits.kde.org/gwenview/c2439f20fcabbde514a18389e4718b397bc0bd17 *** Bug 241574 has been marked as a duplicate of this bug. *** *** Bug 300730 has been marked as a duplicate of this bug. *** |