Here you can release everything that can be easily recreated.
- Data structures that are built or serialized from storage.
- Used data if you cached it
- Data from the network, if you cached it.
A common idiom in iOS software is the use of lazy initialization.
init ivars init, getter , :
@interface ViewController ()
@property (strong,readonly)NSString *testData;
@end
@implementation ViewController
@synthesize testData=_testData;
-(NSString*)testData
{
if(nil==_testData)
_testData=[self createSomeData];
return _testData;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
_testData=nil;
}
testData , didReceiveMemoryWarning, .