诊断错误:“释放发送到已解除分配的对象”
我收到此错误消息:
message [CFString release] sent to deallocated object at 0x........
我怎样才能知道哪个字符串导致了此问题?我可以使用调试器找出它正在使用哪个 CFString
吗?
I received this error message:
message [CFString release] sent to deallocated object at 0x........
How can I know which string caused this problem? Can I figure out which CFString
it is using the debugger?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您使用的是 XCode 4,请使用 Zombie 工具(构建和配置文件)。出现此消息时,您可以按箭头获取保留和释放字符串的所有位置的列表。
If you are using XCode 4, use the Zombie instrument (Build and Profile). When this message occurs, you can press the arrow to get a list of everywhere the string was retained and released.
请参阅 http://www.cocoadev.com/index.pl?NSZombieEnabled 来输入一个断点并在堆栈中查找它发生的释放语句。
See http://www.cocoadev.com/index.pl?NSZombieEnabled to put in a breakpoint and look back up the stack to find release statement where it occurred.
首先,您可以尝试查找代码中的 alloc/dealloc 函数,并对其进行计数。
它是“count alloc == count dealloc”。
第二步,寻找一些构造:
或者尝试使用
NSLog(%"retain count :%d", [myString keepCount]);
进行调试At firts, you can try lookup your code for alloc/dealloc functions, and count it.
It's has been as "count alloc == count dealloc".
The second step, look for some construction:
Or try debug with
NSLog(%"retain count :%d", [myString retainCount]);