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

Re: Autorelease Question


  • Subject: Re: Autorelease Question
  • From: Filip van der Meeren <email@hidden>
  • Date: Wed, 19 Nov 2008 23:59:26 +0100

It will not be contained in a NSAutoreleasePool per-se.
Lets say you create a console application, then you would have to make the choice, will I use the NSAutoreleasePool, or try it without (most likely you will, or you wouldn't be able to use autorelease or use any methods that use this method).
If you use the cocoa GUI and the NSApplicationMain that is in your "void main(args)" then you won't have to worry about this since the NSApplicationMain method will set up the pool for you.


Filip van der Meeren
http://www.sourceforge.net/projects/xlinterpreter

On 19 Nov 2008, at 23:52, Carmen Cerino Jr. wrote:


What do you me by comtain in an autorelease pool? Won't it be in one because blah was created using a factory method?
Sent from my iPhone


On Nov 19, 2008, at 5:47 PM, Filip van der Meeren <email@hidden > wrote:

As long as you do not contain the "blah" in a NSAutoreleasePool, then you do not have an issue...
Just use "return blah;".


Filip van der Meeren
http://www.sourceforge.net/projects/xlinterpreter

On 19 Nov 2008, at 23:37, Carmen Cerino Jr. wrote:

I am not sure the best way to phrase this question into words, so I
will phrase it using example code.

- (NSString*)foo
{

 NSString blah = [NSString string];

 .........


//Now do I do: return blah;

 //Or:
 return [[blah retain] autorelease]];
}
_______________________________________________

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


_______________________________________________

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


References: 
 >Autorelease Question (From: "Carmen Cerino Jr." <email@hidden>)
 >Re: Autorelease Question (From: Filip van der Meeren <email@hidden>)

  • Prev by Date: Re: Autorelease Question
  • Next by Date: Re: Autorelease Question
  • Previous by thread: Re: Autorelease Question
  • Next by thread: Re: Autorelease Question
  • Index(es):
    • Date
    • Thread