Application terminated at middle - objective-c

Here My problem is when Im running my build in the device sometimes my application is terminated at middle with displaying the message in the console as:
Program received signal: "0".
warning: check_safe_call:could not restore current frame
Can anyone help why this was happening like this? Anyones's help will be appreciated.
Thank you,
Monish Kumar.

This is very possibly caused by an infinite loop which is causing you to run out of memory and the debugger can't unwind the stack because there's too much recursion.
Set a breakpoint in the debugger at some point directly preceding the crash and then step through the operations in your code to find where the problem is occurring.

It looks like crash caused by low memory. Try to implement -applicationDidReceiveMemoryWarning: in your application delegate and free unnecessary resources there.

Related

Debugging EXC_BAD_ACCESS

I've not worked on this project in quite some time.. When I left it some time in the iOS 8s it ran just fine, however.. on the latest XCode I'm getting many inconsistent EXC_BAD_ACCESS crashes. Now afaik it's requiring a deallocated object. However, the error is lacking where to look. This is quite a big project and like I say, the errors are inconsistent.
I've tried enabling zombie objects, as well as passing it as a starting parameter. However, this is leading me to no joy. I'm expecting something in the debug console with zombies enabled, is this right?
If anyone has any tips on how to find an easier way to debug this, as opposed to tinkering with everything and hoping it works..
EXC_BAD_ACCESS just means that your app is trying to access an invalid memory address. While it is oft caused be a deallocated object, that isn't always the case.
When the app crashes, there should be a crash log or backtrace. Post it as that'll provide clues.
Lovely; a crash entirely in framework code. Seeing as how it is SceneKit that is crashing, I would suggest replacing any graphic assets with new ones and see if that fixes it (even if it doesn't look right). Then check to make sure all of your geometries and layouts are correct.
Have you tried adding a global Exception or Symbolic breakpoint? Those usually help me 99% of the time when I encounter issues without any sort of backtrace.

No SystemOutOfMemoryException

My App suddenly crashes at one point (reproducible) when run on a 512mb phone emulator (only have a 920 to test). There wasn't any exception, it just went black. I then ran the analysis tool on the application and found out the memory reaches its limit at the point the app crashed. The app exits with an error code. The most recent one I found was 0x887a0005, but I'm pretty sure I saw another one a little time back. Sadly, I don't have that one anywhere.
I load about 600 images from the web into BitmapImages with the CreateBackground option, and handle the ImageOpened event.
I'm not asking for help managing the problem itself, I'll find a way to work around it. I'm just wondering why the App isn't throwing any exceptions, and instead just crashes. Any ideas her
This is expected behavior. Depending on which piece of code is executing at the very moment you run out of memory, an out of memory exception may be thrown - if one can be thrown by that specific .NET class or under laying class. But the operating system is not going to wait for this to happen, and will usually just terminate your app. It's not sending your app a "terminate" or "out of memory" signal, it just kills it.

I have an error occurring in the machine code for a release that I wrote [duplicate]

I've got an app that gets information from a SOAP web service and I want to display the results in a UITableView.
I had a previous version of this app and I'm creating a new version to basically clean things up and get rid of a bunch of legacy code that's deprecated and no longer used.
In the previous version, this worked well. In the new version, not so much.
Basically, the current scenario is returning 3 strings that I'm trying to use as the basis for the data in my UITableView.
I'm struggling with this issue because it's so stinkin' hard to track down EXC_BAD_ACCESS errors!
(Parenthetically, if someone has a way to make the debug experience more like Visual Studio, I'd love to hear it! It's so frustrating to not have any idea which line caused the error, and also to not be able to look through my local variables at the time of the crash to see what's what. I've already added in the exception breakpoint, but that doesn't seem to do much.)
Anyway, the line that's causing the error APPEARS to be:
return [[self Libraries] count];
It occurs in tableView:numberOfRowsInSection:.
The error message I get APPEARS to reference a string that should be stored in the NSMutableArray [self Libraries].
What's going on here?
I'm using ARC, so shouldn't all of my memory management be correctly handled?
I don't have any manual release statements in my code ANYWHERE!
Please help me fix this!
Set NSZombieEnabled, MallocStackLogging, and guard malloc in the debugger. Then, when your App crashes, type this in the gdb console:
(gdb) info malloc-history 0x543216
Replace 0x543216 with the address of the object that caused the crash, and you will get a much more useful stack trace and it should help you pinpoint the exact line in your code that is causing the problem.
See this article for more detailed instructions.
ARC relies on the Apple standard/recommended naming practices. Check that you are not violating any of them.
Just for starters, if "Libraries" is an instance there are are naming issues.
OK, so I feel a little bit silly, but I've got two production machines. On one of them, I had installed a copy of Xcode 4.2 beta alongside the final, production copy. I forgot to uninstall the beta copy and was using it to run my code. As soon as I cleared that up and ran my code against the final, released Xcode 4.2, all works fine again.
As I mentioned to Jonathan Grynspan above, I DO understand Obj-C memory management. For some reason, I was getting a retain/release/release (performed by ARC), and that bug is remedied in the final version.
Thanks for the help in tracking this down! At least I got a definitive answer to WHY the problem existed!

How to track down a CFRetain crash?

I've been trying to tackle this crash and just don't know where to begin. Can someone help me figure out how to use Xcode's tools to navigate this information properly to find the culprit? I don't even know what these details are:
The Instruments tool should be your first port of call - particularly the leaks and allocations analyser.
To use it, select the Profile option off the Product menu in Xcode.
You might like to investigate using the NSZombie object which is designed to catch over-releasing of objects.
It may of course be that you're simply passing a pointer to something that is not a Core Foundation/Cocoa object where one is expected.
A good first step for xcode debugging is often setting an exception breakpoint. To do this select the exceptions tab in the left sidebar, and click the plus at the bottom and select Exception breakpoint. This can help because it will pause execution at the point any exception is thrown thus making it easier to track down.
That said, based on the screen shot you have posted, it looks like an object is getting released twice, so that might not help as much. Using log statements or additional breakpoints throughout the code might help you track down where the problem is occurring.
The details shown in the screenshot are the compiled assembly code, annotated with what is being called. CFRetain is used internally by cocoa to release objects (ie in the implementation of -release).

Random Crashing and weird console output

I wrote an entire app, and I was just about to submit it to the app store, and in my final testing, I went back and added a few releases to ensure proper memory management was observed. And since then, I keep getting these random crashes. I've tried removing some or all of the release calls, I've tried retaining objects. I cleaned the project. I used NSZombieEnabled and that also is not helping. All this to not avail.
Most of the time, the console says provides no help. Usually the app loads, I put NSLogs in viewDidLoad, viewDidAppear, and viewWillAppear, and they all show up in the console, then it crashes.
Sometimes I also get EXC_BAD_ACCESS (and I know what that means). But its occurring randomly. So this doesn't make sense to me. Thanks for any help possible. I've written this whole app, and spent months on it. So I'm really stuck. Thank you.
Have you tried Build --> Analyze? It will search your code for leaks and other useful things you might have missed. Try that and see if it finds anything for you.
I agree with Rudy. It sounds like you're releasing something that is still in use. I would go back to the version that was working and start adding the releases one at a time til it causes the crash. Slow but effective debugging.
When you say that you "sometimes" get EXC_BAD_ACCESS, what do you get the rest of the time? Where does the crash stack indicate you're crashing? What messages do you get?
Random crashes usually indicate a timing problem. A common cause is accessing things on multiple threads. Are you? It can also mean timing differences based on network traffic.
Make sure the console doesn't indicate an exception rather than a memory violation. Usually there's something in the console that will be useful.