Evry third time I start my app or HelloMap followed by tutorial crash with this message:
01-27 18:44:06.743: ERROR/dalvikvm-heap(2700): 262144-byte external allocation too large for this process.
01-27 18:44:06.743: ERROR/dalvikvm(2700): Out of memory: Heap Size=5639KB, Allocated=3280KB, Bitmap Size=10692KB
01-27 18:44:06.747: ERROR/(2700): VM won't let us allocate 262144 bytes
01-27 18:44:06.747: WARN/dalvikvm(2700): threadid=27: thread exiting with uncaught exception (group=0x4001e390)
01-27 18:44:06.747: ERROR/AndroidRuntime(2700): Uncaught handler: thread Thread-14 exiting due to uncaught exception
01-27 18:44:06.757: ERROR/AndroidRuntime(2700): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
01-27 18:44:06.757: ERROR/AndroidRuntime(2700): at android.graphics.Bitmap.nativeCreate(Native Method)
01-27 18:44:06.757: ERROR/AndroidRuntime(2700): at android.graphics.Bitmap.createBitmap(Bitmap.java:569)
01-27 18:44:06.757: ERROR/AndroidRuntime(2700): at javax.microedition.lcdui.Image.createImage(Unknown Source)
01-27 18:44:06.757: ERROR/AndroidRuntime(2700): at com.nutiteq.components.MapTile.getImage(Unknown Source)
01-27 18:44:06.757: ERROR/AndroidRuntime(2700): at com.mgmaps.cache.ScreenCache.add(Unknown Source)
01-27 18:44:06.757: ERROR/AndroidRuntime(2700): at com.nutiteq.BasicMapComponent.tileRetrieved(Unknown Source)
01-27 18:44:06.757: ERROR/AndroidRuntime(2700): at com.nutiteq.BasicMapComponent.tileRetrieved(Unknown Source)
01-27 18:44:06.757: ERROR/AndroidRuntime(2700): at com.nutiteq.components.MapTile.setImagesData(Unknown Source)
01-27 18:44:06.757: ERROR/AndroidRuntime(2700): at com.nutiteq.io.UnstreamedTileRetriever.dataRetrieved(Unknown Source)
01-27 18:44:06.757: ERROR/AndroidRuntime(2700): at com.nutiteq.task.RetrieveNetworkResourceTask.streamOpened(Unknown Source)
01-27 18:44:06.757: ERROR/AndroidRuntime(2700): at com.nutiteq.net.DefaultDownloadStreamOpener.openInputStream(Unknown Source)
01-27 18:44:06.757: ERROR/AndroidRuntime(2700): at com.nutiteq.net.DefaultDownloadStreamOpener.openInputStream(Unknown Source)
01-27 18:44:06.757: ERROR/AndroidRuntime(2700): at com.nutiteq.task.RetrieveNetworkResourceTask.execute(Unknown Source)
01-27 18:44:06.757: ERROR/AndroidRuntime(2700): at com.nutiteq.task.RetrieveNetworkResourceTask.execute(Unknown Source)
01-27 18:44:06.757: ERROR/AndroidRuntime(2700): at com.nutiteq.task.TaskWorker.executeTask(Unknown Source)
01-27 18:44:06.757: ERROR/AndroidRuntime(2700): at com.nutiteq.task.TaskWorker.run(Unknown Source)
I run app on real device Android 2.1. It is not proffesional that app crashes evry thrid start, sometimes during started app, app crashes with same problem. Jaak, you said that now you can't solve this problem and that Android memory managment has bug. But sometimes it is so bad that I need to start app few times before it run normaly. For end user it is a big big problem. gMaps work fine on Android. SDK for Android has a big problem. It is better for me and end users to use google mapComponent, if this bug you can't fix.
Hello,
I made some patches to make things a lot better on Android with this issue.
Here are the important patches:
https://github.com/camptocamp/android-gis/blob/master/patches/07_MemoryCache-LinkedList.patch
---
https://github.com/camptocamp/android-gis/blob/master/patches/08_outofmemory.patch
The fixes from jbaubort are now in the SDK latest build, get it from www.nutiteq.com/beta/lib and let us know if it helps. Preliminary tests show that it is looks certainly better.
The only phone where I have problem is HTC wildfire (Android 2.1) even with new beta library. Evry third start I get force close message and in DDMS above message. I upgrade 2.1 to 2.2 but nothing is changed.
I try on HTC Magic Android 1.5 and it works OK. After 8-10 starts it crashes.
On Sony Ericsson Xperia mini10 pro Android 1.6 it works OK. After 9-11 starts it crashes.
And on HTC Desire HD Android 2.2 after more than 20 starts it crashes.
Only on wildfire, it is a big problem for end user...
Please try the beta lib again - it has updates for this; and let me know if the issue is still there.
I try and it's much better. After 9-10 starts app crashes. With older lib it was after 3 starts. I test on HTC wildfire (minSDdkversinon="3").
I think that in new beta elementClicked is more sensitive then in older lib.
With new lib I get Force close when I try to setMap after mapComponent.startMapping(). With older lib and same code evrything works.
I get this:
02-22 20:39:27.651: ERROR/AndroidRuntime(4349): FATAL EXCEPTION: main
02-22 20:39:27.651: ERROR/AndroidRuntime(4349): java.lang.IllegalArgumentException: y must be >= 0
02-22 20:39:27.651: ERROR/AndroidRuntime(4349): at android.graphics.Bitmap.checkXYSign(Bitmap.java:280)
02-22 20:39:27.651: ERROR/AndroidRuntime(4349): at android.graphics.Bitmap.checkPixelsAccess(Bitmap.java:912)
02-22 20:39:27.651: ERROR/AndroidRuntime(4349): at android.graphics.Bitmap.getPixels(Bitmap.java:877)
02-22 20:39:27.651: ERROR/AndroidRuntime(4349): at javax.microedition.lcdui.Image.getRGB(Unknown Source)
02-22 20:39:27.651: ERROR/AndroidRuntime(4349): at com.mgmaps.utils.Tools.scaleImage20(Unknown Source)
02-22 20:39:27.651: ERROR/AndroidRuntime(4349): at com.mgmaps.utils.Tools.scaleImage20(Unknown Source)
02-22 20:39:27.651: ERROR/AndroidRuntime(4349): at com.nutiteq.BasicMapComponent.createZoomBufferAndUpdateScreen(Unknown Source)
02-22 20:39:27.651: ERROR/AndroidRuntime(4349): at com.nutiteq.BasicMapComponent.createZoomBufferAndUpdateScreen(Unknown Source)
02-22 20:39:27.651: ERROR/AndroidRuntime(4349): at com.nutiteq.BasicMapComponent.setZoom(Unknown Source)
02-22 20:39:27.651: ERROR/AndroidRuntime(4349): at com.norios.Settings$1.onPreferenceChange(Settings.java:127)
02-22 20:39:27.651: ERROR/AndroidRuntime(4349): at android.preference.Preference.callChangeListener(Preference.java:756)
02-22 20:39:27.651: ERROR/AndroidRuntime(4349): at android.preference.ListPreference.onDialogClosed(ListPreference.java:219)
02-22 20:39:27.651: ERROR/AndroidRuntime(4349): at android.preference.DialogPreference.onDismiss(DialogPreference.java:384)
02-22 20:39:27.651: ERROR/AndroidRuntime(4349): at android.app.Dialog$ListenersHandler.handleMessage(Dialog.java:1047)
02-22 20:39:27.651: ERROR/AndroidRuntime(4349): at android.os.Handler.dispatchMessage(Handler.java:99)
02-22 20:39:27.651: ERROR/AndroidRuntime(4349): at android.os.Looper.loop(Looper.java:143)
02-22 20:39:27.651: ERROR/AndroidRuntime(4349): at android.app.ActivityThread.main(ActivityThread.java:4914)
02-22 20:39:27.651: ERROR/AndroidRuntime(4349): at java.lang.reflect.Method.invokeNative(Native Method)
02-22 20:39:27.651: ERROR/AndroidRuntime(4349): at java.lang.reflect.Method.invoke(Method.java:521)
02-22 20:39:27.651: ERROR/AndroidRuntime(4349): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
02-22 20:39:27.651: ERROR/AndroidRuntime(4349): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
02-22 20:39:27.651: ERROR/AndroidRuntime(4349): at dalvik.system.NativeStart.main(Native Method)
02-22 20:39:27.671: WARN/ActivityManager(103):
Hello, here is a fix for this bug, in case you use the sources.
https://github.com/camptocamp/maps-lib-nutiteq/commit/8b06285adae2560333641e5e76625981899ea5b3
I try on some expensive Android phone, and it works much better. On some phone after 10 start of app it creases, and on some more then 20 starts after app crash. So, I hope on most phone it will work most of time.