On 17 Sep 2008, at 10:59 am, Dave DeLong wrote:

NSString * str = [NSMutableString string];
//do stuff with str
[[str retain] release];

HOWEVER, that might cause funky things to happen with the autorelease pool. So the best idea is to do nothing and let the autorelease pool take care of it.

Back to school ;-)

This does nothing at all. It increments the retain count, then decrements it again. It doesn't cause anything "funky" with the autorelease pool nor does it reclaim the memory occupied by the string. It does nothing. Release != dealloc. However, the advice "you don't need to do anything" is correct - the string will be autoreleased.

Review:

http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html


hth,

Graham
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to