Re: [Foo new] vs [[Foo alloc] init]:
Re: [Foo new] vs [[Foo alloc] init]:
- Subject: Re: [Foo new] vs [[Foo alloc] init]:
- From: Bill Bumgarner <email@hidden>
- Date: Sat, 16 Feb 2008 17:25:26 -0800
On Feb 16, 2008, at 4:49 PM, Keith Duncan wrote:
I'm guessing, but perhaps the assumption made on Apple's part is
that if you are linking against the 10.5 SDK then your are more then
likely using GC and zones are irrelevant? AFAIF zones can be used to
improve alloc/dealloc performance, i.e they can be setup such that
the cost of dealloc'ing a large group of temporary objects is very
low by simply removing references to their heap section allowing
immediate reuse without the dealloc tear down cost. Correct me if
I'm wrong.
That is part of the answer.
Another issue is that there is no -dealloc upon zone destruction.
Thus, any class whose instances require some kind of tear down at time
of destruction are going to cause major problems. The resulting bugs
are often subtle, difficult to deduce, and the fix is often to
effectively start doing full-on retain/release in the zone, obviating
the point of such a zone in the first place.
As well, any object graph maintained within a zone must be entirely
isolated from the rest of your app's object graph upon zone
destruction. This includes stuff like run loops and the notification
center.
Finally, zones actually tended to fragment the heap unless used
extremely carefully.
While zones were a good idea, their use tended to be more problematic
than a boon.
b.bum
_______________________________________________
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