We are developing an Hybrid app and we are using google map API in our application. When we are trying to load 2000 data markers in the map, it got crashed. Map is not get crashed in IOS6, IOS5. It is happening only in IOS7. Is there any memory related change done for ios7 application.
Join them; it only takes a minute:
|
|
As said previously iOS7 is more strict with memory usage. This behavior occurs in other browsers like Chrome, so when an app reach upper limit in memory usage, the crash appears. I have isolated two test cases using only Gmaps javascript API and jQuery: Testing with 100 markers: Everything it's ok http://jsfiddle.net/edfFq/6/embedded/result Testing with 3000 markers: Crash occurs http://jsfiddle.net/edfFq/7/embedded/result/
You can get the crash with a less number of markers if your map uses: labels, custom icons and clusters. |
|||
|
|
|
Having experienced similar problems with Google Maps I tried to isolate a minimal test case. I wanted to see if this was perhaps a more general memory management issue. This code that just stores random data in an array crashes Safari on IOS 7 on an iPad mini, 16GB:
You can try this test with your own browser by going http://vici.org/memtest.html . The script on that page will try to claim 50Mb of memory, in steps of 1Mb. The script shows a running counter so you will see how well your browser performs and when it crashes (if it does). The script stores the results for each ip / user agent combination in a database to be able to draw some conclusions. On average, IOS 6 (n=12) allows a script to claim about 12Mb. IOS 7 (n=47) allows a script to claim around 15 Mb. These are not hard limits. For both sets the standard devation was quite high, ~12 Mb. In the Xcode emulator Safari doesn't even crash at all (claiming the full 50Mb, probably because it has access to more RAM). So we may conclude that the issue is not caused by IOS 7 leaving less memory for Safari. The problem seems to be, as was suggested by Philipp Kühn, that -in some specific cases? - Safari consumes significantly more memory than it did in IOS 6. One clue about the cause can be found at https://discussions.apple.com/message/23837361#23837361 where a page with 200 divs and the following CSS
crashes safari. It appears that using the Leaflet library circumvents the maps issue (see https://code.google.com/p/gmaps-api-issues/issues/detail?id= and https://github.com/Leaflet/Leaflet/pull/2149) however Leaflet circumvented the low memory crashes not by changes on the css but on the javascript level. Leaflet now circumvents statements like
This would suggest Safari doesn't clean up unused objects. As long as Apple doesn't fix Safari, perhaps Google could do changes similar to what the Leaflet guys have done? In the mean time Apple has release IOS7.1 which doesn't fully solve the crashes but certainly makes them occur les often. |
||||
|
|
|
We have a webapplication, that chrashes too with many markers on iOS7. So we took a closer look at the memory the iPad use. iPad mini (and iPad3) with iOS7: The memory usage is getting higher and higher and between 300-400MB the browser chrashes. iPad 3 with iOS6 The memory usage is about 200MB and everything is fine. iPad 1 with iOS5 The memory usage is only about 100MB and everything is fine. Conclusion So this is NOT just a memory limit – it's definitely a huge bug on the iOS safari! And until now (iOS 7.0.3) this is not fixed. |
|||||||||||||||||
|
|
Good news! we switched over our apps framework from google to leaflet and it works beautifully, no crashing, we checked the debug and it runs extremely high memory but never crashes. If you have not already go with Leaflet, it fully works on iOS 7, |
|||
|
|
|
Our application behaved in the same as the users above; everything worked well prior to iOS 7, yet crashed afterwards. The problem indeed does appear to be a memory issue. You can verify by checking the crash report logs on your device. As our application was essential to a client, we couldn't sit and wait for a fix from Apple. In our case, the fix involved three specific strategies:
This did the trick! Our application is now crash free. Considering the amount of time (not to mention frustration!) this issue caused me, hopefully these strategies will give you a jumping off point to get your application back up and working. Feel free to get in touch if you wanted something a little more specific. Good luck! |
|||||
|
|
I believe IOS7 has a memory cap of 5Mb (longer battery life), it used to be 50Mb or something like that. Since the cap is limited with OS, so it does not matter if you are using Chrome, Safari or other browsers, it will crash if exceeded. i tested my receiving data limit to 20 from SQL, and it works on all browsers on my iphone (pad). |
|||
|
|
|
I had the same problem and tried out a few things. I disabled the animation when markers are set (I had about 30 being added at once) and it seems like it doesn't crash any more now. Hope that helps. |
|||||
|
|
We have the same issue with Labels on google map. When map zoom in app get crashed. This started to happen after upgrade in to IOS 7. I am trying different options like remove and add label in events like "drag" and "idle". This code works but still crash occur. but less often. I hope someone might have better fix for this.
|
|||
|
|
|
If you are dealing with a large number of markers, try using the MarkerClusterer. It will lower the number of concurrent markers significantly, and in our case it prevented the crash. |
|||
|
|
|
Heyy... I was also facing the similar problem. So, I tried this: I cleared the application caches in "didReceiveMemoryWarning" method of my view controller and custom plugins and set the properties and variables to NIL in "onMemoryWarning" method of CDVPlugin class. And this approach did the work for me. I am not getting any crash as of now. Hope this helps. |
|||
|
|
|
Seems to be fixed in iOS 7.1 Yesterday on iOS 7.0.6, my map would crash Mobile Safari with more than 3,000 markers. Today after upgrading my iPad, I can load a map in Mobile Safari with over 15,000 markers. |
|||
|
|
protected by Brad Larson♦ Sep 30 '13 at 15:08
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?