我有以下启用 ARC 的代码
@property (nonatomic, weak) NSArray *a;
- (void)viewDidLoad
{
[super viewDidLoad];
self.a = @[@1, @2];
NSLog(@"ab is %@", self.a); //prints details of array
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
for (id element in self.a) { //empty here
NSLog(@"blah");
}
// Dispose of any resources that can be recreated.
}
这是我唯一用过的地方self.a
。这是我为调试我的一个问题而编写的测试程序。
当我模拟内存警告self.a
消失?为什么?