Reputation: 19869
I see that many people are allocating and releasing NSStrings.
I understand that the benefit is that the string is being released immediately and not by autoRelease.
my questions :
will appreciate any explanation.
Thanks
shani
Upvotes: 0
Views: 382
Reputation: 540
I don't see how you could re-use a NSString. Reusing a NSMutableString instance might be slightly faster the recreating it but you won't see the difference. Focus on simplicity and maintainability of your code.
I think your question is wether to use [[NSString alloc] init] or [NSString string]. As long as performance is not an issue, always go with the simplest one. That would be the autoreleased version, because you don't need to release it yourself.
Upvotes: 1
Reputation: 1636
NSAutoreleasePool
pool.Upvotes: 1