NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
NSData *data = nil;
data = [prefs dataForKey:[NSString stringWithFormat:KEY_STR, index]];
the NSData actually has 1.5M size, can I release the memory, as soon as I done with data?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’d need to create your own NSAutoreleasePool for this operation:
But unless you have a good reason to, you should know that as soon as you’re done handling the event you’re handling and the app returns back to the main run loop, the default autorelease pool will drain and your memory will be released. So I wouldn’t worry about it unless you think there’s a good reason to.