cfischer
cfischer

Reputation: 24902

"__NSAutoreleaseFreedObject(): release of previously deallocated object" out of the blue

I'm not sure if this is an error or not. The code compiles fine (no warnings), but when I enter a method, a local's value (an NSMutableString) displays this content in the debugger:

__NSAutoreleaseFreedObject(): release of previously deallocated object

enter image description here I'm not getting an exception, it looks like the contents of the string (which is not even allocated at that time) is that NSAutoReleaseFreedObject warning.

What's going on?

Upvotes: 0

Views: 774

Answers (2)

Chuck
Chuck

Reputation: 237030

If you don't initialize a normal local variable to anything, its value is undefined — it could be anything. In practice, it will interpret the bit pattern that happens to lie on the stack where the variable is allocated as a value of the variable's type. In this case, the "anything" that the variable contains happens to be the address of that string.

Upvotes: 1

justin
justin

Reputation: 104698

it (likely) means that your app has executed different from usual, and exposed a bug in your ref counting of the object. this type of issue can also be related to improper multithreading.

executing your app to trigger the problem with zombies enabled should help you locate it.

Upvotes: 1

Related Questions