• 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: nested autorelease pools?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nested autorelease pools?


  • Subject: Re: nested autorelease pools?
  • From: j o a r <email@hidden>
  • Date: Tue, 1 Nov 2005 21:34:53 +0100


On 1 nov 2005, at 21.16, Brian O'Brien wrote:

Does this look valid to you?

-(id) init
{
	self = [super init];
	mypool = [[NSAutoreleasePool alloc] init];
	return self;
}

-(void) dealloc
{
	[mypool release];
	[super dealloc];
}

NSAutoreleasePool is a very special class, with special requirements. The above is incorrect, because (as snipped from the documentation of this class):


"An autorelease pool should always be released in the same context (invocation of a method or function, or body of a loop) that it was created."

An autorelease pool lives in "execution scope", and not "object scope".

j o a r


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: nested autorelease pools?
      • From: John Stiles <email@hidden>
References: 
 >nested autorelease pools? (From: "Brian O'Brien" <email@hidden>)

  • Prev by Date: nested autorelease pools?
  • Next by Date: NSSpellChecker and learning words.
  • Previous by thread: nested autorelease pools?
  • Next by thread: Re: nested autorelease pools?
  • Index(es):
    • Date
    • Thread