Instruments crashing while using Leaks instrument - iphone

Ok, so heres the issue. I'm attempting to debug an app with instruments but every time i try to use the Leaks instrument Instruments crashes about 3 seconds into it. This only occurs when i try to use it with an actual device, it will run fine when its just attached to the simulator.
I have reinstalled Xcode and Instruments on 2 different computers, and am running the latest version. This isn't an issue with the app either because i have tried it with 2 other apps and the same thing happens. Also, i have tried this with multiple different devices and the same thing is happening.
Any suggestions?

I was just experiencing 100% reproducible crashes in Instruments (not very productive) that seem to have been fixed by rebuilding the spotlight index (sudo mdutil -E /), so that might be worth a try for anyone who can't get Instruments to run for more than a few seconds.

Before running you instruments, go to:
File->Recording Options->disable "Record reference counts"

Related

Xcode - Instruments - Leaks: Plain Not Working... Can we debug leaks?

Basically
what is happening is I was using leaks and it was being flakey, Working correctly at random times and not others. And now it decided just not to work, I launch it from Xcode Run -> Run with PErformance Tool -> leaks and it starts launching the application but stops and appears to crash.
I don't have any warnings, errors or even analyzer marks.
So... Is there a way to debug Instruments? or at least see why it's crashing the App?
The annoying part is I know I have 5 small leaks left that I may or may not have fixed...
I found Instruments has a crash log out in the library... Did the trick to find out what my problem was.

Running Instrument->leaks and debugger console at the same time in xcode

My program is crashing when using the memory leak instrument in xcode (yet it is showing no memory leaks). I would like to be able to run the debugger console at the same time to see what's happening. Is this possible? thanks
Yes - in the simulator at least.
The way to do this is to first run your app in instruments, then stop the app (this just makes sure Instruments knows about your application and that Instruments is up and running). Then restart the app in the debugger.
Now go back to Instruments, and select "attach to process" - selecting your application from the drop-down. You can start recording now and the debugger will also be functional.
I'm not 100% sure it's possible, but if it is, you would do it by starting from Instruments or XCode, and then in the other one attach to the process. In XCode you do this by going to Run -> Attach to Process. In Instruments you do it by going to Choose Target -> Attach to Process, in a new window.
If you just want to see NSLogs and other debug messages, you can open the Console app.

iphone app crashes?

i am running my program using iphone simulator n at some point application crashes..but there is no error...just getting Debugging terminated in debugger console
how i can check this what is the problem of crashes?
How about memory leaks?? If you are alloc-ing a lot of variables and not releasing them this can cause memory leaks. Which will in time cause the app to crash with a black screen. Try running your app with the "Leaks" tool. Go to Run -> Run with Performance Tools -> Leaks. Go through everything you can in the app with this tool running and it will inform you of any memory leaks.
Here is a good link for information about using the Leaks Instrument:
http://mobileorchard.com/find-iphone-memory-leaks-a-leaks-tool-tutorial/
Also check your code!! If you know where its crashing go and check the code and make sure your doing everything you intend to!
Try to look into crash logs. You can find them in ~/Library/Logs/CrashReporter

Why does the release build of my iPhone app crash on the device on the first run after installation?

I have an iPhone app that's been in development for about 2 weeks. We recently tried the "release" version of the build on a device, and to our great unhappiness, it crashes in one of the views with an "EXC_BAD_ACCESS".
This crash only occurs on devices, and only in the "release" build. Not only that, but it only happens the first time the app is launched! It is also 100% reproducible.
We have removed the small block of code that deals with data persistence, and have tried re-openning Xcode, cleaning the project, deleting and reinstalling the app, etc., as some other questions suggest.
Do you have any advice for a) what might be causing this problem, and b) how to go about debugging if it only happens in "release"?
Thanks
It turns out there was no problem in the code at all.
The reason it was crashing was that Xcode was trying to attach the debugger to the release build for some reason! We are still trying to figure out why, because we have checked the most obvious places, but I'm sure it won't be too hard to track down.
The build works fine if you install from iTunes or the Xcode organizer instead of building and running from Xcode directly, so it won't affect your end-users at all, as long as you are careful to check for other first-run issues.
We can only guess what the cause might but if it's 100% reproducible, then it should be a good candidate for some fprintf-style debugging.
Figure out the most probable place for the error to occur, and start putting "Got past xxx view initialization" style statements in to start narrowing the problem. It's tedious, but eventually, you'll get there.
In theory fprintf statements could affect the problem. However, it's rare that it does so, so it's a good place to start.

iPhone simulator => debugging terminated

When I start my iPhone application it boots up fine, shows the first settings screen and all after I have given input and pressed save, the debug window says
Debugging Terminated
without any hint to why in the crash logs.
First I thought it was my programming, but then I went ahead and tested the app on multiple 'real' iPhones and it never crashed.
Why does the simulator keeps crashing?
A common cause of crashes on the simulator but not the device and vice versa is using precompiled libraries that were compiled on the other hardware. Check if you've got something compile for ARM that is trying to run on the Intel.
In XCode try Build > Clean All Targets
Have you tried resetting the simulator? iPhone Simulator -> Reset Content and Settings
Then do a clean build of your project.
Annoying :)
Put NSLog statements around where you think that it's crashing and look at the output. That shoud give you more of an idea where the crash is occurring.
If that doesn't help, post the lines causing the crash in the question and see if anyone can help then.
Sam
This tends to happen when you declare a variable and then use it without actually creating it. I would check variables you are using to make sure you are actually creating them before using (i.e. with alloc or the convenience methods).