Bug 330231

Summary: GoogleMaps : Memory leak when map is displayed
Product: [Applications] digikam Reporter: Samuel Gilbert <samuel.gilbert>
Component: Geolocation-GoogleMapsAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles
Priority: NOR    
Version: 3.5.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 5.0.0
Sentry Crash Report:

Description Samuel Gilbert 2014-01-21 05:18:16 UTC
There is a memory leak when viewing a geo-location map.

I used ksysguard to monitor memory usage.

- When digikam is loaded, it uses about 200 MB
- If I scroll an album with 300 pictures page by page digikam's memory usage stabilize around 430 MB
- Even I go to another big album with another 3000 pictures, the memory footprint stays around 430 MB
- If I restart digikam and select the same album, but I display a map (by using the earth icon on the right edge of the window), digikam will use over 500 MB of RAM after scrolling through about 200 pictures.
- The same thing happens by selecting Image -> geo-location in the menu and scrolling around.  Even if the geo-location window is closed, the memory footprint doesn't go down significantly.
- After geo-location session of about 1.5 hour, digikam uses more than 2 GB of RAM on my laptop

Reproducible: Always

Steps to Reproduce:
1. Fire up digikam
2. In the menu, select Image -> geo-location
3. Scroll to different places, change zoom.  I can get it to eat up 300 MB per minute just by scrolling the map at the maximum zoom.
4. Close the geo-location window and notice that memory usage hasn't significantly diminished
Actual Results:  
Lots of memory is used and never gets freed up unless digikam is closed

Expected Results:  
Memory usage should stabilize after awhile and it should go down to what it was before when the geo-location window is closed
Comment 1 caulier.gilles 2014-01-21 06:45:11 UTC
Which map mode you use ? GoogleMaps, Marble, OpenStreetMaps ?

Gilles Caulier
Comment 2 Samuel Gilbert 2014-01-21 18:28:50 UTC
I noticed the problem with GoogleMaps.  I will test with OpenStreetMaps tonight.

I can also test with marble, but the detail level is insufficient for what I want to do.
Comment 3 Samuel Gilbert 2014-01-30 05:29:43 UTC
The issue doesn't turn up with marble regardless of the layer displayed (OpenStreetMaps or Atlas).  


A bit of unrelated info :
Unfortunately, with marble, the OpenStreetMap tiles are not displayed at their native size or projection which makes them ugly and sometimes, it's impossible to read lables.
Comment 4 Samuel Gilbert 2014-01-30 05:30:33 UTC
The issue doesn't turn up with marble regardless of the layer displayed (OpenStreetMaps or Atlas).  


A bit of unrelated info :
Unfortunately, with marble, the OpenStreetMap tiles are not displayed at their native size or projection which makes them ugly and sometimes, it's impossible to read labels.
Comment 5 caulier.gilles 2014-08-24 21:30:30 UTC
Can you report a memory analysis running digiKam through valgrind as explained here :

https://www.digikam.org/contrib

Can you see these memory leak using last digiKam 4.2.0 ?

Gilles Caulier
Comment 6 caulier.gilles 2015-05-12 13:47:27 UTC
Samuel,

Did you see my previous comment ?

Also last digiKam is 4.9.0. It will be nice to see an update using this version.

Gilles Caulier
Comment 7 Samuel Gilbert 2015-05-12 16:04:21 UTC
Hi Gilles,

Indeed your message had slipped under the radar.  Sorry!

I'm already using 4.9.0.  I probably won't have time to check until the weekend, but I'll get to it.

Samuel
Comment 8 caulier.gilles 2015-09-24 13:16:00 UTC
Git commit 40dd102ba1c3a0ea39a84ec5656d967c79627c8c by Gilles Caulier.
Committed on 24/09/2015 at 13:11.
Pushed by cgilles into branch 'frameworks'.

Geolocation Edit always refresh database contents about GPS info and after write to file metadata if it's possible.
To read GPS Info from item, it try in first database else file metadata.
Geolocation map view is now based to QWebView instead KHTML. So we cannot see no more memory leak and tiles dysfunction with GoogleMaps.
Note : in 5.0.0, Geolocation Edit tool is now also available in ImageEditor, Showfoto and LightTable.
Related: bug 208227, bug 317241
FIXED-IN: 5.0.0

M  +4    -1    NEWS
M  +8    -7    app/main/digikamapp.cpp
M  +1    -0    libs/database/CMakeLists.txt
A  +147  -0    libs/database/item/imagegps.cpp     [License: GPL (v2+)]
A  +59   -0    libs/database/item/imagegps.h     [License: GPL (v2+)]
M  +9    -1    libs/database/item/imageposition.h
M  +2    -2    showfoto/main/showfoto.cpp
M  +2    -2    utilities/geolocation/editor/CMakeLists.txt
R  +35   -35   utilities/geolocation/editor/dialog/geolocationedit.cpp [from: utilities/geolocation/editor/dialog/gpssyncdialog.cpp - 094% similarity]
R  +7    -7    utilities/geolocation/editor/dialog/geolocationedit.h [from: utilities/geolocation/editor/dialog/gpssyncdialog.h - 091% similarity]
R  +14   -14   utilities/geolocation/editor/dialog/gpsgeoifacemodelhelper.cpp [from: utilities/geolocation/editor/dialog/gpssyncgeoifacemodelhelper.cpp - 082% similarity]
R  +7    -7    utilities/geolocation/editor/dialog/gpsgeoifacemodelhelper.h [from: utilities/geolocation/editor/dialog/gpssyncgeoifacemodelhelper.h - 086% similarity]
M  +4    -4    utilities/geolocation/editor/dragdrop/mapdragdrophandler.cpp
M  +3    -3    utilities/geolocation/editor/dragdrop/mapdragdrophandler.h
M  +23   -20   utilities/geolocation/editor/items/gpsimageitem.cpp
M  +24   -0    utilities/geolocation/editor/items/gpsimageitem.h
M  +1    -1    utilities/geolocation/editor/reversegeocoding/rgwidget.cpp
M  +8    -7    utilities/imageeditor/main/imagewindow.cpp
M  +8    -7    utilities/lighttable/lighttablewindow.cpp

http://commits.kde.org/digikam/40dd102ba1c3a0ea39a84ec5656d967c79627c8c