Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Foo new] vs [[Foo alloc] init]:



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: [Foo new] vs [[Foo alloc] init]: (From: Jonathan Dann <email@hidden>)
 >Re: [Foo new] vs [[Foo alloc] init]: (From: Keith Duncan <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.