iPhone app crashes randomly without any error or stack trace

10,345

Solution 1

My app crashes randomly after certain amount of time interval without any error logs or stack trace. I suspect it's an memory issue.

To confirm that it's a memory issue, sync your device with iTunes,and look in ~/Library/Logs/CrashReporter/MobileDevice/ for a files with LowMemory in their name. If you see (jettisoned) next to your app name, that confirms it was killed by iOS for using too much memory.

The only other way an app could exit without leaving a crash report is if it erroneously called exit().

For more information, see "Debugging Deployed iOS Apps", and "Understanding and Analyzing iOS Application Crash Reports".

Solution 2

Not sure but reading the registers might help.

First go to Exceptions tab and 'Add Exception Breakpoint' using the + at the bottom left corner. enter image description here

Then when the app crashes click on "0 objc_exception_throw" under Thread 1 enter image description here

Finally in the console enter:

  • register read (you should get a list of registers)

  • po $rax (normally the exception is in 'rax')

    (you should see the exception output on the console)

Hope this helps.

Solution 3

That does sound like maybe the device is running low on memory and shutting you down. There's lots of threads on stackoverflow on debugging memory warnings.

This one talks a little about what to look for when using the Instruments tool.

Here is an explanation of how to get the memory warning level, and what the codes mean.

There is no fixed memory limit on iPhones. I've asked Apple support representatives this question, and they wouldn't give me a fixed answer (probably because the algorithm does not actually enforce any one hard limit for a 3rd-party app).

And, yes, ARC can be a wonderful thing. In your situation, you might have to rework a lot of code to make it all ARC-compliant, but ARC is definitely a useful feature, and can produce programs with fewer memory problems, with less work by the coders (leaving you more time to fix other problems!)

Share:
10,345
Kunal Balani
Author by

Kunal Balani

If someone knows what exactly I do , please let me know !!

Updated on July 11, 2022

Comments

  • Kunal Balani
    Kunal Balani almost 2 years

    I am new here . Sorry if I this question is being repeated but I have a slightly different issue than the others.

    My app crashes randomly after certain amount of time interval without any error logs or stack trace. I suspect it's an memory issue . I have the following questions :

    1.) How to get stack trace (I have tried NSZombie enabled and NSUnacughtExcpetion handler) but didn't worked

    2.) I get Memory warning frequently in my app. How do I confirm whether it's the prime suspect for the above issue? (I have used Leaks, my app crashes when it has just 4Mb usage so I am not quite sure whether memory leak is causing it my app to crash. I know certain application which take heap memory more than 4MB .)

    3.) What is the upper limit for Memory leak for an application in iOS before app crashes ?

    4.) Would ARC help me in this situation ?

    Also, I have tried to debug issue using NSLog statements but since it crashes randomly , it would be hard for me to detect the root cause using this technique.

    Any ideas would be or help would be really appreciated