我正在编写一个执行类似操作的程序:
- (void)viewDidLoad {
[super viewDidLoad]; propertyList = [[NSMutableDictionary alloc] init];
for (SensorData* _data in _res) {
AttributeLine* newLine=[[AttributeLine alloc] init:idx];
[propertyList setObject:newLine forKey:[_data textValue]];
[newLine release];
}
}
- (void)dealloc {
[propertyList release];
[super dealloc];
}
它不是完整的代码,但有我所做的逻辑。问题是:当程序到达 [propertyList release] 指令时,以 EXEC_BAD_ADDRESS 失败。如果我评论该指令一切正常,但我有内存泄漏。任何想法 ?
[由bbum编辑:marco在下面说他的dealloc是正确的,代码仍然崩溃]