Re: Custom zones...
Re: Custom zones...
- Subject: Re: Custom zones...
- From: Alastair Houghton <email@hidden>
- Date: Tue, 10 Aug 2010 15:12:10 +0100
On 10 Aug 2010, at 14:55, Bill Bumgarner wrote:
> On Aug 10, 2010, at 1:31 AM, Alastair Houghton wrote:
>
>> Sounds like a bug to me. While zones are *discouraged* (they're very definitely an advanced topic and easily misused), I don't think they're actually deprecated.
>
> Their use is deprecated and should be documented as such.
I guess that's a documentation bug, then, since there don't seem to be many deprecation markings that I can see, and NSZone is documented all over the place.
> The key problems were two fold. First, if a reference to an object in the zone escaped said zone and wasn't cleaned up prior to zone destruction, you ended up with an entirely unfathomable crash. This happened often. Secondly, if any object was allocated in the zone that required some kind of more-than-dealloc-or-free operations to occur when deallocated, the zone's destruction would bypass that. Nothing like a dangling backing store [window] to brighten your debugging day!
Indeed, that's why I said "easily misused".
That said, is the part about objects escaping zones really true for *NS*Zone? It's true for malloc zones, for sure, but the docs for NSRecycleZone say:
Frees zone after adding any of its pointers still in use to the default zone.
(This strategy prevents retained objects from being inadvertently destroyed.)
which seems to imply otherwise.
You *are* just talking about *NS*Zone, right? malloc zones are very useful and I definitely don't want to see those go away (I'm thinking of a certain million-plus node data structure we maintain that we'd have to go calling free() a million or more times to release...)
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
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