PDA

View Full Version : Fixing Crime City Crashes



Nicholost
03-08-2012, 12:56 PM
Preface
We've all experienced this at one point or another. You do some event (rob someone, open the rivals list, complete a game mission, etc.) and Bam!, the Crime City app crashes. Of course, Murphy is there to ensure it occurs at the worst possible time (e.g. finally find a no-banking player). The cause is likely that Crime City is asking for more runtime memory than your device has available to provide it. CC loses that memory battle and the device shuts the app down. There may be other causes, but in my experience, cashes tend to be tied to events (clicks and new windows).

Analysis
The iPod Touch (3G & 4G) and iPhone (3GS) come with only 256MB of runtime memory, or RAM. (Later iPhones have 512MB.) Don't confuse this with physical memory (i.e. 8GB, 16GB or 32GB). When idle, my iPod sits at around 110MB of free memory. After I start up Crime City, play for a bit, then quickly switch over to my memory usage app, I see that my available memory is about 75MB. That quickly grows to about 105MB as memory is freed up by CC closing. There may be more scientific approaches to monitoring memory usage while apps are running, but this is what I have to work with, so bear with me.

As you use your device, apps take memory while they are in use and release that memory when they close, but many times those amounts are not equal. These are called memory leaks. Almost all software has them to some degree, no matter how well written they are. If it has been a long time since your last restart, it is likely that apps, CC included, have taken and not released a good portion of your memory. This leaves you with a much smaller amount of free memory for apps to use. Since, CC is probably not a lightweight app (based on the graphics, level of detail, its many windows, and the number of server calls it makes), it probably requires a hefty chunk of memory to run. If CC is using most of the available memory, it is at risk of crashing due to an out of memory event. That’s my guess anyway. I don’t have access to source code or some of the professional tools that would shine light on this.

Fix
This is going to sound stupid, but the first thing you should do it restart your device. Seriously. This will clear any memory that been mistakenly earmarked as in use. You can do this by holding the on/off button and home button for 3 seconds, then swipe the Shut Down slide bar. Once the device is shutdown, turn it on using the on/off button.

Another method is to download one of many memory management apps to manually forcefully free up memory. I personally use SYS Activity Manager by Appsware. It works pretty well and does free up additional memory, but it’s still not as effective as a restart.

A neat trick that not many people know of is that you can forcefully terminate apps. This is different from closing the app from the recently accessed app list. Instead, with the app you want to terminate running, hold on/off button and home until you see the shutdown screen (~3 seconds). Now hold down home for ~8 seconds. The screen should flash and the app should close. I’m not sure what the effects of doing this are, so you may want to use this methods sparingly and in worst case scenarios.

Conclusion
I did my last restart over a week ago and have started using SYS Activity Manager every other day since then. I have experienced zero crashes at all. That’s remarkable considering CC used to crash every 8-10 minutes of use (I actually used to time it because it was so frequent).

Notes:
These findings were based of experiences with CC v2.0.2 and v2.2. Later CC releases may not be as susceptible to crashes as these releases. Technically, it has more to do with your device's free memory and less to do with the app anyway.

While I am a software developer, I am not a hardware guy, nor do I care for Apple products or claim to know much about them. If any of the above information is wrong, let me know and I will correct it.

Swifty
03-08-2012, 01:03 PM
Nicholost, thanks for the analysis.

I have found that regularly restarting my iPad does solve a lot of problems.

Ramshutu
03-08-2012, 01:30 PM
"These are called memory leaks. Almost all software has them to some degree, no matter how well written they are"

The software engineer wants to shout at you! Memory leaks are a sign of badly written code!

Realistically, however, I doubt this is a memory issue. Remember that everything you do will allocate and delete memory. There seem to be only a few specific situations in which the crashes occurr. If this was 'out of memory' I would expect a lot more undefined and weird behaviour to occur at many different times on many different apps than are occurring.

Saying that, I can only speculate at a better answer. the best I can suggest is corrupted cache files!

Max Power
03-08-2012, 01:40 PM
Anecdotal, I know, but on my iPod Touch 32gb, I used to crash regularly. As Funzio updates occurred, it got much better. While the iPod crashes on rare occasion these days, my new iPhone 4s has yet to crash in 3 months of playing the game.

koralene
03-08-2012, 01:40 PM
I bloody restart mine three times a day... still have problems. its bloody annoying!!! This needs to be solved... NOW

Nicholost
03-08-2012, 01:41 PM
These are called memory leaks. Almost all software has them to some degree, no matter how well written they are.

The software engineer wants to shout at you! Memory leaks are a sign of badly written code!
Hehe! I like making software engineers shout. :D


Realistically, however, I doubt this is a memory issue. Remember that everything you do will allocate and delete memory. There seem to be only a few specific situations in which the crashes occurr. If this was 'out of memory' I would expect a lot more undefined and weird behaviour to occur at many different times on many different apps than are occurring.

Saying that, I can only speculate at a better answer. the best I can suggest is corrupted cache files!
That may totally be the case. The only reason why I think it's memory related is that once I started actively managing my used memory, my crash problem went away. The app would crash literally after every 8-10 minutes of active use, yet I could leave it running all night. To have this issue disappear right after I started managing memory usage is quite the coincidence. But I do agree, usually memory problems present themselves in much different ways. Crashing on events in not usually memory related.

Caleb
03-08-2012, 02:36 PM
...my new iPhone 4s has yet to crash in 3 months of playing the game.

Wow, Max, wish I had that stability with mine! I think things have improved, but I'd say I still get a crash every day or two. As in Nicholost's first post, darned if almost every crash isn't at a particularly inopportune moment.

Labradorite
03-08-2012, 05:12 PM
Seems crashes only happen on iPod and iPad 1, not on iPhone and iPad 2, right???

Swifty
03-08-2012, 05:27 PM
When I said iPad, I actually meant iPad2 in my case.

And it will crash if I do not restart it at least once a day.

ss30
03-09-2012, 04:22 AM
CC crashes on my 3gs even though each night I restart my phone

Yahkin
03-09-2012, 08:29 AM
Ipad2 crashes on average once a day for me. One thing I've noticed is that Rival hoods will start to take longer to load. When that starts to happen, I shut the app down and let it clear itself up. Come back in and things are better.

The most annoying crashes are the ones where you happen upon an uncollected Nightclub, collect on it, and you see the money bounce out...only to crash and have lost the cash and the rival from your list.