• 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: How can I release an NSString?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can I release an NSString?


  • Subject: Re: How can I release an NSString?
  • From: email@hidden
  • Date: Sun, 19 Jan 2003 10:51:39 +0100

On dimanche, janvier 19, 2003, at 10:11 AM, Arthur VIGAN wrote:

Hi,

I have a quite simple question, which I find annoying...
Let's consider the following method:

- (NSString *)giveMeAString
{
NSString *aString;

aString = [NSString stringWithString:@"Hello World!"];

return aString
}

My question is: is memory leaking in this code, because the string is never released? Should I use autorelease?

stringWithString: is returning an autoreleased NSString * so you have to do nothing.

A good article on retain/release/autorelease is the http://www.stepwise.com/Articles/Technical/HoldMe.html one and if you have access to the WWDC 2002 DVD or ADC TV, I strongly recommend session 302.
_______________________________________________
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.
  • Follow-Ups:
    • Re: How can I release an NSString?
      • From: Jim Correia <email@hidden>
References: 
 >How can I release an NSString? (From: Arthur VIGAN <email@hidden>)

  • Prev by Date: Re: AppKit deadlock
  • Next by Date: Re: How can I release an NSString?
  • Previous by thread: How can I release an NSString?
  • Next by thread: Re: How can I release an NSString?
  • Index(es):
    • Date
    • Thread