NSArray内部成员的所有权?没有ARC

时间:2014-10-25 00:07:22

标签: memory-management memory-leaks xcode5 nsarray automatic-ref-counting

是否有关于ARC的内存泄漏?

NSMutableArray *array = [[NSMutableArray alloc] init];
NSNumber *numberForTest = [[NSNumber alloc] initWithInt:123456];
[array addObject: numberForTest];
[numberForTest release];
NSLog(@"number = %@", numberForTest); //safe to access "numberForTest" after calling release???
[array release];

我担心的是:

[array addObject: numberForTest]; 

之前,

使“numberForTest”无法解除分配

[array release]; 

??? 使用静态分析器后,不会报告泄漏。输出始终是正确的。但我感觉不舒服。

1 个答案:

答案 0 :(得分:0)