If I have the following code:
NSString* test = @"12345... 1Kb worth of characters";
test = [test substringFromIndex:512];
Then would the memory consumed by test be halved (from 1024 to 512 bytes) or do I have to do something to tell it to release the memory?
Thanks,
Joe
After such call new memory for substring will be
allocated. But your stringtestis marked asautoreleased. So previous value oftestwill be automaticallyreleasedand new value will be assigned. Notice that new value (substring) will be tooautoreleasedand you don’t need toreleaseit manually.