Random crashes - possible causes?

My game crashes randomly. Sometimes it crashes after a level is done, sometime it crashes when I am in the menu screen. How long it takes to crash varies as well. Because of the randomness it’s proving very hard to troubleshoot. Both physical and texture memories are fine (not high and not leaking). I am not manipulating objs when there’s a collision happening.

What are some known APIs or practices that cause crash? [import]uid: 39031 topic_id: 19675 reply_id: 319675[/import]

Are you using ads? Inneractive or Inmobi? I get crashes when using ads. [import]uid: 70134 topic_id: 19675 reply_id: 76082[/import]

Nope. No ads, no OF or GC. Only gaming components. Nothing fancy. [import]uid: 39031 topic_id: 19675 reply_id: 76091[/import]

any global variable getting disposed but still into some function calling somewhere? [import]uid: 67641 topic_id: 19675 reply_id: 76098[/import]

timers ending calling call backs that are no longer in memory?

Any event handlers that are firing?

Audio ending and not cleaning up?
[import]uid: 19626 topic_id: 19675 reply_id: 76108[/import]

I’d second the advice to check for timers that haven’t been properly cleaned - that seems to be a common culprit. [import]uid: 52491 topic_id: 19675 reply_id: 76126[/import]

Thanks for the good suggestions.

I am not using any audio at the moment.
I have paid special attention to the timers and event handlers to make sure everything was properly disposed of but I will double-check.

By the way, this happens almost only on the device (iOS 4.2.8) and I get no errors whatsoever in the simulator.
[import]uid: 39031 topic_id: 19675 reply_id: 76143[/import]

“almost only” - meaning it also happens in the simulator but no errors are produced? (Just trying to confirm.)

The Xcode log could be useful here, although sometimes they just look like gibberish :wink:

Peach

[import]uid: 52491 topic_id: 19675 reply_id: 76154[/import]

I said “almost” because when the game crashes about 10 times on a device, the simulator would crash maybe once. Since the simulator has been crashing once in a very while, I can’t say that what’s causing the game to crash on my phone is causing the simulator to crash.

My feeling is that whatever is causing the crashes on my phone is NOT the cause of the simulator crash, just because the frequency is very different.

How would I go about pulling a log from Xcode? Never done that before.

Thanks! [import]uid: 39031 topic_id: 19675 reply_id: 76220[/import]

Are you using physics?
At some point I had some random crashes when using physics.stop()
The solution was to remove all physics bodies one by one before
calling physics.stop() [import]uid: 13632 topic_id: 19675 reply_id: 76229[/import]

Yes, I am using several physics bodies but I am not sure I am using physics.stop() off the top of my head. Let me check that and get back to you.

Maybe I should make a “things to check for random crashes” list since I am getting lots of good suggestions :slight_smile: [import]uid: 39031 topic_id: 19675 reply_id: 76287[/import]

No physics.stop is being used.

Should I stop physics when going to the menu & game over screen then restart? Or, is it not needed? [import]uid: 39031 topic_id: 19675 reply_id: 76321[/import]