message sent to deallocated instance
来源:互联网 发布:江苏大学网络教学平台 编辑:程序博客网 时间:2024/05/01 01:53
转自http://www.cnblogs.com/qingjoin/p/3515902.html
在XCode的以前版本中,如果遇到了
[代码]c#/cpp/oc代码:
1
message sent to deallocated instance 0x6d564f0
在新的XCode里,调试器默认使用LLDB,我就讲一下如何在LLDB状态下定位到由于内存操作不当引起的Crash
首先我有一段会发生崩溃的代码:
[代码]c#/cpp/oc代码:
1
NSString *themePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:themePathTmp];
2
if
(themePath)
3
self.backgroundIV.image = [UIImage imageWithContentsOfFile:[themePath stringByAppendingPathComponent:
@"mask_1.png"
]];
4
5
[themePath release];
运行代码,出现下面的崩溃现象
下面我们打开“活动监视器”,找到我们对应的PID,我们的Target为HPThemeManager,只要找到HPThemeManager对应的PID就可以(HPThemeManager是在论坛里下载的,本来正在看代码,就直接拿他来作试验了)
现在,我们得到了两个主要的信息:
进程ID:50127
崩溃地址:0x6d564f0
我们打开终端,输入以下命令:
[代码]c#/cpp/oc代码:
1
sudo malloc_history 50127 0x6d564f0
结果显示为:
这样我们用能定位到这行代码
[代码]c#/cpp/oc代码:
1
NSString *themePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:themePathTmp];
对themePath进行排查,就找到了崩溃的罪魁祸首
[代码]c#/cpp/oc代码:
1
[themePath release];
原文地址: http://www.devdiv.com/lldb_message_sent_to_deallocated_instance_-blog-50901-50856.html 0 0
- message sent to deallocated instance
- message sent to deallocated instance
- message sent to deallocated instance
- message sent to deallocated instance
- message sent to deallocated instance
- message sent to deallocated instance
- message sent to deallocated instance
- message sent to deallocated instance
- message sent to deallocated instance
- message sent to deallocated instance
- message sent to deallocated instance
- message sent to deallocated instance
- [UIImage _isCached]: message sent to deallocated instance
- message sent to deallocated instance 除錯
- message sent to deallocated instance 除錯
- “[CALayer release]: message sent to deallocated instance
- [CALayer release]: message sent to deallocated instance
- message sent to deallocated instance 的解决办法
- GRE写作必备句型
- POJ 3279 Fliptile (二进制+搜索)
- NSArray(不可变数组)、NSMutableArray(可变数组)、数组排序、NSNumber(多态:数值和对象互转)、NSValue(将结构体转换成对象)
- EJB笔记---JBoss 开发环境搭配
- 收藏网站14
- message sent to deallocated instance
- iOS开发 - CoreData框架 数据持久化
- Contains Duplicate II
- 扩展的欧几里得模板
- 收藏网站15
- PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged
- spring component-scan扫描 context:exclude-filter 与 context:include-filter
- 收藏网站16
- 由RGB到HSV颜色空间的理解