• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using NSMutableString* for NSString* result
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Re: Using NSMutableString* for NSString* result (From: "Alastair J.Houghton" <email@hidden>)

  • Prev by Date: Re: Using NSMutableString* for NSString* result
  • Next by Date: Re: Using NSMutableString* for NSString* result
  • Previous by thread: Re: Using NSMutableString* for NSString* result
  • Next by thread: Re: Using NSMutableString* for NSString* result
  • Index(es):
    • Date
    • Thread