别了 Release
想当时iOS SDK 2.1开始编写iOS程序,一开始就需要考虑什么时间,什么地点Release,稍有不慎就会导致Crash,Zombies.
费了老大功夫终于搞定什么时候Release,当时小得意一下.
Release就是代表了你iOS的功力有多深!!!
iOS5 ARC这个东东,我尝试了一下
作为测试,写了一个很简单的代码
- (IBAction)ArcTestClick:(id)sender {
for (int i=0; i<1000; i++) {
UIWebView * w=[[UIWebView alloc] init];
w.backgroundColor=[UIColor blueColor];
}
for (int i=0; i<1000; i++) {
UIWebView * w=[[UIWebView alloc] init];
w.backgroundColor=[UIColor blueColor];
}
}
然后分别用Instruments的Allocations测试效果
No ARC
图如下:
新建一个项目勾选了 Automatic Reference Counting.
别了release.