Manish Burman
Manish Burman

Reputation: 3079

NSZombieEnabled seems to fix my errors

I seem to be having a few exc_bad_access errors in my app. Here's where it gets weird - when I set NSZombieEnabled = YES, the errors don't seem to get reproduced. The app works perfectly. This question has been asked before, but my question is more along the lines of why this is happening. I know that traditional objective C objects should be flagged down if the issue lay with them, right? So does this point to the problem lying somewhere else? If so, where? Any help would be much appreciated.

NSZombieEnabled FIXES my app?

Upvotes: 0

Views: 357

Answers (2)

Manish Burman
Manish Burman

Reputation: 3079

The problem all along seemed to be with CFMutableBitVector. I wasn't setting a count, and up ended up accessing elements beyond its range. As a result I was getting an EXC_BAD_ACCESS error further down the road. NSZombieEnabled=YES for some reason seems to fix this. Anyway, I corrected the issue.

Upvotes: 0

dtuckernet
dtuckernet

Reputation: 7895

NSZombieEnabled exists solely to diagnose a small handful of problems. It actually disables the core way that memory management works within iOS. If this solves your problems, then you are likely sending messages (calling methods) on objects that have already been deallocated.

Be sure to fully understand memory management in iOS and then your problems will be solved (NSZombieEnabled isn't a solution):

http://www.raywenderlich.com/2657/memory-management-in-objective-c-tutorial

http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/MemoryMgmt/Articles/MemoryMgmt.html

Upvotes: 2

Related Questions