views:

46

answers:

2

Having recently installed the 4.0 SDK, I recompiled a client project to test how it would run under the new OS. (Previously testing with 3.1.3 had no crashes and only one memory leak, duly reported to Apple, who were unable to reproduce on 4.0 beta 3, and so closed.)

Everything went very smoothly (no crashes during testing) until I decided to run it with Leaks, which causes my app to crash every time I run it.

All the crash logs look like this:

Thread 0 Crashed:
0   libobjc.A.dylib                 0x00002866 objc_msgSend + 10
1   MyApp                           0x000040b0 0x1000 + 12464
2   MyApp                           0x000040b0 0x1000 + 12464
3   MyApp                           0x000040b0 0x1000 + 12464
...
511 MyApp                           0x000040b0 0x1000 + 12464

I also have leaks all over the place, but the Responsible Library is always one of Apple's, and my app never appears in the stack trace. At least for the leaks that have stack traces... some of them are General Block leaks with no stack trace at all.

Any ideas?

Update: The above holds for my iPhone 3GS running iOS 4. When I run the build on my iPod Touch 1st gen running 3.1.3, I can't even launch Leaks, never mind get it to crash... but I can build-and-debug on that older device just fine.

(I am setting my Base SDK to 4.0 and the Deployment Target to 3.1.2)

A: 

It looks like you have a method recursively calling itself which leads to a stack overflow.

Try compiling your application with debug symbols enabled so the method will be revealed (hopefully).

Claus Broch
That is a debug build. Also, I can run this build just fine without any crashes when I Build and Debug through Xcode proper. This crash only happens when I try using the Leaks instrument.
Shaggy Frog
A: 

Claus Broch is correct, this is caused by recursion. If this is a debug build, it might be the debugger itself causing problems.

There is more than usual chatter about debugger issues from people who upgraded to Xcode 3.2.3. I had problem with the debugger hanging at random in an apparent runaway recursion that had nothing to do with the particular code. I only solved it by deleting my /Developer directory entirely and reinstalling the 4.0SDK.

I usually don't like to blame the tools but in this case it might be warranted.

TechZen