在Xcode and Instruments我看到UILabel (CALayer)使用大量的虚拟内存(匿名VM).我看到每个大约235 KB的虚拟内存UILabel.
我认为这可能是iOS 7.1或7.1.1的新问题.
这是预期的吗?
我创建了一个简单的程序,创建500 UILabels并Instruments显示115MB的内存使用.在大约1500个标签处,应用程序由OS终止.
for (int i = 0; i < 500; i++)
{
index = (int)[self.items count];
index++;
frame = CGRectMake(10.0, 20, 300.0, 50.0);
UILabel *newLabel = [[UILabel alloc] initWithFrame:frame];
newLabel.text = [NSString stringWithFormat:@"This is text for label: %d", index];
newLabel.backgroundColor = [UIColor whiteColor];
[self.view addSubview:newLabel];
[self.items setObject:newLabel forKey:[NSNumber numberWithInteger:index]];
}
Run Code Online (Sandbox Code Playgroud)
思考?