#import "ViewController.h" #import "EOCPerson.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. //自動釋放池:autorelease pool。用於存放哪些須要稍後某個時刻釋放的對象 NSArray *databaseRecord ; NSMutableArray *people = [NSMutableArray new]; for (NSDictionary *record in databaseRecord){ //減少內存使用最大峯值 @autoreleasepool { EOCPerson *person = [EOCPerson new]; [people addObject:person]; } } //自動釋放池機制就像「棧stack」同樣,系統建立好自動釋放池以後,就將其推入棧中,而清空自動釋放池,則至關於將其從棧中彈出。 } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end