Program received signal :"SIGKILL"
来源:互联网 发布:淘宝装修备份在哪 编辑:程序博客网 时间:2024/05/16 05:29
如果在-(void)dealloc{}方法中,用self.tableVIew=nil清空内存。那么会影响到-(void)viewDidLoad{}方法中的tableView(即[self.view addSubView:tableView]中的tableView),tableView事实上内存已经清空了,地址为:0x0。
这个赶脚不对。因为明显就是先执行viewDidLoad方法,当退出该界面时才执行dealloc,所以感觉这个解释不能接受。所以这篇文章仅供大家参考,提供思路。
路过的大大们如果有神马高见,欢迎留言
发生Thread 1:Program received signal:"SIGKILL". 错误时内存管理不当。
举个例子:
-------------------------------------------------------------
MyViewController.h
@interface MyViewController : UIViewController{
}
@property (nonatomic,retain) UITableView *tableView;
@end
-----------------------------------------------------------------
MyViewContrller.m
@implementation
@synthesize: tableView
-
[super viewDidLoad];
tableView=[[UITableView alloc] init];
[self.view addSubView:tableView];
}
-
[tableView release],self.tableView=nil;
[super dealloc];
}
------------------------------------------------------------------
如果你开了NSZombieEnabled,会有Thread 1:Program received signal:"SIGKILL".错误。
办法就是去掉self.。
细看-(void)viewDidLoad{}和- (void)dealloc{}方法,里面都有tableView。
如果在-(void)dealloc{}方法中,用self.tableVIew=nil清空内存。
那么会影响到-(void)viewDidLoad{}方法中的tableView(即[self.view addSubView:tableView]中的tableView),tableView事实上内存已经清空了,地址为:0x0。
虽然retainCount≠0,但当执行-(void)dealloc{}方法中的[super dealloc]时,release或清空地址为:0x0的subView:tableView 就发生错误。
所以要去掉self.,在-(void)dealloc{}方法中,用tableVIew=nil清空内存,就不会影响到-(void)viewDidLoad{}中的tableView。
- Program received signal :"SIGKILL"
- Program received signal: “0”
- Program received signal: "SIGABRT"
- program received signal:SIGABRT
- Program received signal: “EXC_BAD_ACCESS"
- Thread1:Program received signal
- 解析:Program received signal: “EXC_BAD_ACCESS"(
- 解析:Program received signal: “EXC_BAD_ACCESS"
- 解析:Program received signal: “EXC_BAD_ACCESS"
- 解析:Program received signal: “EXC_BAD_ACCESS"
- Program received signal SIGPIPE, Broken pipe
- iphone gdb program received signal 0
- Program received signal SIGPIPE, Broken pipe
- Program received signal SIGPIPE, Broken pipe
- Program received signal SIGSEGV, Segmentation fault.
- Program received signal SIGPIPE, Broken pipe.
- "Thread 1:Program received signal:"SIGABRT" "分析
- Program received signal SIGPIPE, Broken pipe
- C语言顺序表链式存储(链表)
- 生活感悟
- 写一个函数返回参数值为1的个数
- 开放性敏捷自动化测试架构介绍
- uva 10635(最长公共子序列nlogn)
- Program received signal :"SIGKILL"
- leetcode - plus one
- 参加某培训机构Java培训记录(十一)
- 第一阶段项目总结
- Android旋转屏幕后国际化语言失效的解决办法
- 主设备号--驱动模块与设备节点联系的纽带
- VC导出类得创建和使用
- HDU 1027 Ignatius and the Princess II
- LeetCode:Swap Nodes in Pairs