Possible Duplicate:
Do I need to release NSString generated using @“…”?
There are two ways to create an NSString obj in Objective C
Way 1:
// string1 will be released automatically
NSString* string1 = [NSString string];
// must release this when done
Way 2
NSString* string2 = [[NSString alloc] init];
[string2 release];
If I do
NSString *string = @"This is a string";
My question is which way an above declaration falls in and should we release it after all
String constants are not to be released; they’re neither explicitly to be released neither autoreleased; they’re simply constants and never deallocated.
So, only -release them if you previously retained them.