Re: nested autorelease pools?
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