Note that there are some explanatory texts on larger screens.

plurals
  1. POEXC_BAD_ACCESS, but with no zombies, and not in debug build configuration
    text
    copied!<p>This is driving me nuts. I just uploaded my first app to the App Store for the first time, and of course, now my app is exploding left and right. When I build with release build configuration, I randomly get an <code>EXC_BAD_ACCESS</code> after banging on the app for some variable amount of time. I turned Zombies back on, but the problem doesn't appear to be over-releasing a variable, as I don't get a message about sending a message to a released variable. </p> <p>The error does always appear in the same spot in my code. It looks like I'm trying to retain a variable that hasn't been initialized properly. I haven't the slightest idea how I could be doing that. </p> <p>But here's the weird thing: if I build in debug release configuration, IT NEVER CRASHES. I can bang on the thing all day long, and it's rock solid. I build with Release configuration, and it gets all intermittently crashy.</p> <p>Looking at the Build settings in the two configurations, there aren't that many differences. In debug, the GCC 4.0 Optimization level is "None", while in Release, it's "Fastest, Smallest." If I switch the optimization level in Release to "None," the app behaves itself. Does anyone have a clue what I should be looking for to fix this? Alternately, how many bad things happen if I Distribute with No optimization?</p> <p><strong>UPDATE:</strong></p> <p>Dang! I really need a magic debug tool for memory errors. I've been working this problem for the last day or so. I added an <code>exercise</code> method that would reliably generate a crash and started looking for the area of code that was causing it. </p> <p>The app would usually crash the 3rd-5th time I performed one particular type of operation. The only thing that was different about that type of operation was the value I returned from an accessory method. The accessory method generally returned <code>NSDecimalNumber</code>s with values of 0-3, but there was one special case when I was returning an <code>NSDecimalNumber</code> with a non-integer value. I would test the result of the accessory method looking for the non-integer value. I changed the special case to return an <code>NSDecimalNumber</code> with a value of -1 instead of the non-integer value, and I can no longer make the app crash.</p> <p>Basically, the only change I made was switching from <code>[[NSNumber numberWithDouble:num] decimalValue]</code> --> crash to <code>[[NSNumber numberWithInteger:num] decimalValue]</code> --> no crash</p> <p>It's a little but more complicated than that, but not much.</p> <p>Now, I'm happy that the app no longer crashes but the change I made does not fill me with confidence, as the old bits of code did not appear to be "broken" in any way. So, while my app doesn't crash anymore, it's not because I "fixed" it, I just changed some random thing and now it works. 8^(</p> <p><strong>UPDATE:</strong></p> <p>Debugger does not spit out a stack trace as it usually does when a program crashes. When it crashes, the debug console outputs the following:</p> <p>Loading program into debugger…</p> <p>[... copyright stuff...]</p> <pre><code>This GDB was configured as "i386-apple-darwin".warning: Unable to read symbols for "/System/Library/Frameworks/UIKit.framework/UIKit" (file not found). warning: Unable to read symbols from "UIKit" (not yet mapped into memory). warning: Unable to read symbols for "/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics" (file not found). warning: Unable to read symbols from "CoreGraphics" (not yet mapped into memory). Program loaded. sharedlibrary apply-load-rules all Attaching to program: `/Users/...', process 10066. Re-enabling shared library breakpoint 1 Cannot access memory at address 0x4 Cannot access memory at address 0x4 (gdb) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload