We have an iOS application that runs at ~35MB memory over its lifetime. We are getting crashes after 10 minutes or so of gameplay on an iPhone 4 and iPad that have many other applications in the background. Usually we get a LowMemory warning log (but sometimes not). This LowMemory log shows other programs being jettisoned. No other crash logs are generated. Generally our app appears to be suspended when this occurs, but attempting to un-suspend it causes it to reset.
Is there anything to be done about this (aside from using less memory)? We don’t get any (!) crashes on our 3G - just on the iPhone 4 with heavy multitasking. Are we doing something that might cause iOS to be unable to terminate background apps, or that might cause us to suspend when this occurs?
The first thing to do is hook in a send message for the low memory warnings so you can free up stuff as needed.
The other thing to do is look how much memory you really use. Don’t forget, that you are using more than just the system RAM, because textures you loaded that are in VRAM use up RAM too as they are held in RAM, so its well possible to use 35mb of regular RAM and 100mb of VRAM which would be a lot.
And no you can’t do anything to tell / prevent ios from kicking out background tasks, it will do it on its own as it sees need and it won’t suspend the current active one. if you really get kicked out you either have a lot of background task enabled apps running (skype, audioplayer, gps programs and alike) or you really have masses of stuff in vram and bind just to much ram at the given time.
Are you sure you are not loading resolution / device dependent textures and audio and thus just hit the 3rd / 4th gen devices significantly harder than the 3G? like “decompress on load” audio with much more or larger audio on the new devices?