Re: Using NSMutableString* for NSString* result
Re: Using NSMutableString* for NSString* result
- Subject: Re: Using NSMutableString* for NSString* result
- From: Greg Titus <email@hidden>
- Date: Fri, 3 Oct 2003 10:13:36 -0700
On Friday, October 3, 2003, at 09:56 AM, Alastair J.Houghton wrote:
On Friday, October 3, 2003, at 05:04 pm, Laurent Daudelin wrote:
return [NSString stringWithString:myMutableString]
Or just
return [myMutableString copy];
Nope. The problem there is that you are now returning an object that is
retained. Memory leak. The equivalent to Laurent's line would need to
be:
return [[myMutableString copy] autorelease];
(Not that you should do either of them, as my other post on this topic
argues.)
- Greg
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.