PDA

View Full Version : Out of memory crash with large preinstalled map



mobileDeveloper
06.12.2015, 13:45
I am trying to use the Android SDK with a large preinstalled map (~900MB). To this end, I followed advice found in this forum and put the map in "SKMaps/PreinstalledMaps/v1". I included the package and meta folder.
Furthermore I set the preinstalled maps path and the offline connectivity mode in the map init settings, as used in the demo project.

However, when I expect the map view to be loaded, the app crashes and I receive the following two consecutive errors:

A/libc﹕ Fatal signal 11 (SIGSEGV), code 1, fault addr 0x4 in tid 25684 (GLThread 696)
E/filemap﹕ mmap(0,961803293) failed: Out of memory


Is that a common problem with large preinstalled maps or should I look somewhere else for the cause? How can this problem be resolved?

Adela_Silvia
07.12.2015, 11:41
The first question would be: why do you want to add such a large map to the app?
Would be a viable solution to integrate smaller packages and upload the apps with specific maps based on the country (store)? In this case you shouldn't encounter the mentioned problem.

When does the crash appear? On which devices have you tested?

mobileDeveloper
08.12.2015, 19:39
Thanks for your reply!

I was actually able to get rid of the first error and it turned out not to be related to the map. Sorry for the confusion!

Also I have a quite probable explanation for the second error: the device has 1GB RAM, so a 900MB map is so close that when additional working memory is tried to be allocated, it crashes.

Unfortunately, I cannot follow your advice, as the one single map by itself is of that large size.
Is it possible to leave the map in external memory (SD card) and only load the parts "as needed" into working memory?

dandronic
14.12.2015, 16:11
This should not be a problem as the SDK will not load 900 MBs in the working memory - it will limit itself to ~200-300 MBs depending on the device - a memory profiler/inspector should indicate this.

As for storing the map on the device (physical memory) - you can choose to store it on the SD card to save some space on the device: http://developer.skobbler.com/getting-started/android#sec022