QtWebkit + api.maps.ovi.com + out of memory
Hello,
we are using api.maps.ovi.com for showing a dynamic map on webpage. I have realized that webkit consumes PLENTY of RAM. Only map opening will consume 14Mb of memory. Also, map browsing will consume LOTS of RAM.
I have not found a way how stop memory consuming when you browse map. It consumes memory every time you must download new titles. At some point you run out of memory.
I have tried following code to not cache map titles in RAM. Didn't help. Any other ideas?
QWebView *webview = new QWebView(this);
webview->settings()->setMaximumPagesInCache(0);
webview->settings()->setOfflineStorageDefaultQuota(0);
webview->settings()->setObjectCacheCapacities(0,0,0);
webview->settings()->setOfflineWebApplicationCacheQuota(0);
Regards,
FoL
Re: QtWebkit + api.maps.ovi.com + out of memory
Have you increased (substantially) the size of your heap? The default heap size is from another era and is woefully small for "modern" applications.
Re: QtWebkit + api.maps.ovi.com + out of memory
[QUOTE=danhicksbyron;827500]Have you increased (substantially) the size of your heap? The default heap size is from another era and is woefully small for "modern" applications.[/QUOTE]
Yes I have. It is 32Mb.
Re: QtWebkit + api.maps.ovi.com + out of memory
Hi, first 32MB ain't lot when it comes to QtWebkit.
I haven't used ovi.maps but as it uses (or least I make a good assumption) javascript to load the tiles they would be bound to JSObjects and thus tiles are subject to garbage collection. So, what happens if you force garbage collection e.g with timer?
Do you know if you run OOM or GOOM (Out of Graphics memory) ? GOOM even happens only on Symbian^3 based devices.
There is a lot of extra copying around with the images esp. if using Symbian^3 :S It has already been greatly reduced but even with QtWebkit2.1 it consumes quite a bit of memory.
EDIT:
Also note that if using later QtWebkit and Qt Javascript virtual machine is running on it's own heap and images are store on their own heap. This means increasing epocheapsize has no effect.
Re: QtWebkit + api.maps.ovi.com + out of memory
I have used perfmon for tracing RAM. It runs out of RAM (125Mb -> 90Mb -> out of memory).
How do you force garbage collection?
How do I know if I am using later QtWebkit and Qt Javascript?
Regards,
FoL
[QUOTE=jakoskin;827570]Hi, first 32MB ain't lot when it comes to QtWebkit.
I haven't used ovi.maps but as it uses (or least I make a good assumption) javascript to load the tiles they would be bound to JSObjects and thus tiles are subject to garbage collection. So, what happens if you force garbage collection e.g with timer?
Do you know if you run OOM or GOOM (Out of Graphics memory) ? GOOM even happens only on Symbian^3 based devices.
There is a lot of extra copying around with the images esp. if using Symbian^3 :S It has already been greatly reduced but even with QtWebkit2.1 it consumes quite a bit of memory.
EDIT:
Also note that if using later QtWebkit and Qt Javascript virtual machine is running on it's own heap and images are store on their own heap. This means increasing epocheapsize has no effect.[/QUOTE]
Re: QtWebkit + api.maps.ovi.com + out of memory
[QUOTE=forceoflight;827592]I have used perfmon for tracing RAM. It runs out of RAM (125Mb -> 90Mb -> out of memory).
How do you force garbage collection?
How do I know if I am using later QtWebkit and Qt Javascript?
Regards,
FoL[/QUOTE]
So you run out of that 32MB. to force garbage collector you can call CollectGarbage() from javascript.
If you can control your code you can delete single items as well. Here is some guidelines [url]http://developer.apple.com/library/safari/#documentation/ScriptingAutomation/Conceptual/JSCodingGuide/Advanced/Advanced.html[/url] .
Do you use Qt 4.7.2 and running on Symbian^3 ? and did you install separate QtWebkit.sis from the dir? if yes,yes and yes then you are using latest available to Symbian without building QtWebkit yourself.
Re: QtWebkit + api.maps.ovi.com + out of memory
[QUOTE]Do you use Qt 4.7.2 and running on Symbian^3 ? and did you install separate QtWebkit.sis from the dir? if yes,yes and yes then you are using latest available to Symbian without building QtWebkit yourself.[/QUOTE]
I am using latest stuff.
Re: QtWebkit + api.maps.ovi.com + out of memory
CollectGarbage didn't deallocate any RAM.
How should I proceed?
Re: QtWebkit + api.maps.ovi.com + out of memory
Maybe you should look for leaks in your code.
Re: QtWebkit + api.maps.ovi.com + out of memory
[QUOTE=danhicksbyron;827777]Maybe you should look for leaks in your code.[/QUOTE]
Application might leak memory, but not when we swipe map. All code is javascript based and quite simply code. Basically we have copy pasted code from maps ovi api examples. This must be webkit related issue.
Re: QtWebkit + api.maps.ovi.com + out of memory
It might be webkit issue or it might not. It could be ovi.maps issue it could be Symbian heap issue it could be....
If the ovi-maps script isn't obfuscated check that all the tiles are reserved as vars and are properly deleted. CollectGarbage() cannot delete the images if they are e.g. in global array and thus still in use (refcount > 0).
You can try tweaking epocheapsize to see if there is something allocated from your heap that should be removed. Look for allocators and see which heap they allocate from etc...
If possible can you run this on Chrome on PC side? you can use the built-in debugging tools to look little further what is going on.
Note that the same tools exist on QtTestBrowser.