istornz / iPokeGo

A native iOS client to map the Pokemon around you!
https://github.com/RocketMap/RocketMap
MIT License
642 stars 168 forks source link

Memory Issue #123

Open blackhattristar opened 8 years ago

blackhattristar commented 8 years ago

I'm receiving this message in the Xcode console:

Message from debugger: Terminated due to memory issue

My device is an iPhone 6 Plus with the latest software v9.3.3

My settings in the iPokeGo settings menu are Pokémon, PokéStops, Gyms and Show Timer ON

I forgot to mention that this message is appearing and the app is force quitting when changing scan location.

parrots commented 8 years ago

@blackhattristar can you try things with the code from PR #125 ? I've been debugging and profiling that a lot today and when running on device I haven't seen it go above ~150 megs. Still high, but the memory seems to be under control now and never seems to go high enough to get terminated.

blackhattristar commented 8 years ago

I would recommend scanning in a location like New York City and then try to run a scan at your current location. The app should terminate. At least with the latest version for me, when PokeStops is on and I have PokeStops on the map and then long press to scan, the app freezes and then terminates. I'll take a look at the code from PR #125

parrots commented 8 years ago

@blackhattristar can you email me a server URL running scans in NYC that I can point to to test?

I'm running 8x step-8 scans in my city, which gets me up up to 150megs, but yeah I can guess that NYC might be a lot worse. 😭 Might be hard to optimize for but I'd suspect we need to start only showing annotations in the visible region.

blackhattristar commented 8 years ago

I think the problem is that the map is retaining the PokeStops on the map. If I scan in NYC and then scan in CA, the app is going to terminate because it can't handle all those PokeStops. It will retain the ones that appeared in NYC. I'm running -st 10 in Manhattan, NYC

blackhattristar commented 8 years ago

Your app doesn't terminate when changing scan locations while having PokeStops on?

parrots commented 8 years ago

It hasn't for me, nope. That might be suburbia life though (although I do have a few large regions scanned for a few hundred stops).

img_0921 That has me at 92 megs, with stops and pokemon enabled. (pokemon not recently scanned in south position)

blackhattristar commented 8 years ago

If you're up for the test, you could always try and maneuver over to NYC and scan there to see if it's just me or... Maybe submit a pull request / update the master with the changes you've made to your app to help memory usage? Maybe your version is working but not the latest version on GitHub may have problems when trying to scan multiple populated locations.

parrots commented 8 years ago

There's a pull request in with all the changes I've been making today, just waiting for it to be merged into master. I don't have merge rights.

blackhattristar commented 8 years ago

Very cool. I look forward to testing the updates. Let me know if you try scanning in Manhattan. Trust me, you'll be blown away by the amount of PokeStops and Lured PokeStops there are.

blackhattristar commented 8 years ago

In the meantime, when I get home I'm going to try some of the code fixes from PR #125 and see if anything helps. I'll let you know if the problem continues.

istornz commented 8 years ago

@parrots @blackhattristar Now merged

blackhattristar commented 8 years ago

@istornz @parrots Looks like the problem still persists. When I turn PokéStops on and try to scan the map, the app terminates.

istornz commented 8 years ago

@blackhattristar Strange, I have an iPhone 6 Plus too and I can see a lot of annotation on the map... May be try to delete all app in background.

blackhattristar commented 8 years ago

@istornz Very strange. I don't know how I could be the only one with this issue :p

Have you tried scanning Manhattan, New York City and then scanning your current location? The map is retaining the information on the PokéStops. Which means if I scan in a heavily populated area and then scan in a totally different state, the memory issue arises because the map is retaining those PokéStops in the heavily populated area. Is there any way around this?

blackhattristar commented 8 years ago

There is no problem with scanning as long as PokéStops is turn OFF. :(

blackhattristar commented 8 years ago

@istornz @parrots Is there any way to cluster the PokéStops?

parrots commented 8 years ago

@blackhattristar clustering is possible, but not without a lot of work. Apple doesn't provide a built-in way to do this. There are some third party solutions, but nothing that'd we'd be able to just drop in.

Some ideas on doing it manually here: https://robots.thoughtbot.com/how-to-handle-large-amounts-of-data-on-maps

For now we might want to consider just disabling non-lured pokestops through an option