• 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: NSMutableString question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMutableString question


  • Subject: Re: NSMutableString question
  • From: Dave DeLong <email@hidden>
  • Date: Tue, 16 Sep 2008 19:11:08 -0600

Thanks for the heads up. I think if I had thought about that a little longer I probably wouldn't have written it, because only a couple days ago I had a crash when I tried releasing an already autoreleased object. Whoops. =)

Dave

On 16 Sep, 2008, at 7:07 PM, Graham Cox wrote:


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.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSMutableString question
      • From: Graham Cox <email@hidden>
References: 
 >NSMutableString question (From: John Zorko <email@hidden>)
 >Re: NSMutableString question (From: Dave DeLong <email@hidden>)
 >Re: NSMutableString question (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: NSMutableString question
  • Next by Date: Re: Outlet from Different Implementation?
  • Previous by thread: Re: NSMutableString question
  • Next by thread: Re: NSMutableString question
  • Index(es):
    • Date
    • Thread