Re: what's an NSZone?
Re: what's an NSZone?
- Subject: Re: what's an NSZone?
- From: email@hidden
- Date: Sat, 16 Feb 2002 10:55:43 -0800
What I used to do was allocate an NSZone per document (using my
own document class, before NSDocument existed), and blow away
the zone when I closed the document, after saving it out to a
file. It was a lot quicker than letting every object associated
with the document dealloc itself.
Of course, dealloc often does things besides just freeing the memory
of the object in question. Removing notification observers, getting rid
of timers... this mass-free technique using zones can certainly be
useful, but it was not without problems. I think the strategy in OS X's
malloc implementation was to make it as blindingly fast as possible, so
that alloc/free overhead largely ceased to be relevant. For *most* (but
certainly not all) applications, I think it is a success. For those
applications where you are truly allocating such a large number of small
objects that this overhead is killing you, you can always do your own
custom allocation.
And if I understand the previous messages in this thread, you can
still make your own NSZone and just throw it away; it just gets
allocated as a sub-block inside your main zone, instead of as a separate
zone. I'm not really clear on why people find that so objectionable;
that seems like an implementation detail to me. What am I missing?
Ben Haller
Stick Software
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.