views:

69

answers:

3
-[CFString respondsToSelector:]: message sent to deallocated instance 0x4b9e720

I don't where to start, tried static analyzer and stepped through each line of code but still no help.

+5  A: 

It means you are trying to use an object which has been deallocated - i.e. sent release or removeFromSuperview:

Check this page to see how to enable a debug feature called NSZombie - it keeps objects alive even when released, and lets you know which one you are accessing. The downside is that the program uses much more memory (since nothing is truly released) but you only use it until you have found the problem then turn it off.

Adam Eberbach
is there any way I can tell what object it is? 0x4b9e720
Fasid
NSZombie is already enabled.
Fasid
So what is the string you are sending the message to? CFString narrows it down a bit. Don't you have a stack trace?
Adam Eberbach
+3  A: 

Adam is right. But you should also enable MallocStackLogging.

Let's assume you have this output:

2003-03-18 13:01:38.644 yourApp[**<pid>**] *** *** Selector 'release' 
sent to dealloced instance **<address>** of class NSConcreteData.

Type the following command into gdb (swap and with your values):

malloc_history <pid> <address>

This will tell you where and what has been allocated.

Lars Schneider
it says stack logging disabled due to previous errors when i tried it
Fasid
A: 

Run it in the debugger and look at the stack trace.

tc.
Holy cow! I bet he never thought of that!
Adam Eberbach
The lack of a stack trace suggests that he hasn't.
tc.