• 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: Wed, 2 Nov 2005 07:07:36 +0100


On 1 nov 2005, at 23.13, John Stiles wrote:

Perhaps autorelease pools shouldn't be objects at all, but rather some sort of ObjC language construct? Something similar to the new syntax for exception handling:

@AutoreleasePool
{
	// Stuff
}

And if you're in a tight loop and need to drain the pool every now and then:

@AutoreleasePool
{

	if (SomeCondition)
	{
		@DrainPool
	}
}

I'm not exactly sure what the benefit here is, other than an enforced release of the pool. If that's what you want, just use Objective-C++ and create a C++ class. Its constructor can create the pool, and you can make a method to drain your autorelease pool. When it goes out of scope, the destructor can release the pool. Taking advantage of scoped object lifetimes is a C++ specialty.

My point was simply that in this case the compiler could assist you with doing the right thing, with regards to the scoping of the autorelease pool. Why implement the autorelease pool functionality in the form of a (public) class at all?


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

References: 
 >nested autorelease pools? (From: "Brian O'Brien" <email@hidden>)
 >Re: nested autorelease pools? (From: j o a r <email@hidden>)
 >Re: nested autorelease pools? (From: John Stiles <email@hidden>)
 >Re: nested autorelease pools? (From: j o a r <email@hidden>)
 >Re: nested autorelease pools? (From: John Stiles <email@hidden>)

  • Prev by Date: Icon in MenuBar
  • Next by Date: principalClass crashes
  • Previous by thread: Re: nested autorelease pools?
  • Next by thread: Re: nested autorelease pools?
  • Index(es):
    • Date
    • Thread