• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: what's an NSZone?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: NSViews with NIB?
  • Next by Date: Re: Documents and "Created with:"
  • Previous by thread: Re: what's an NSZone?
  • Next by thread: Re: what's an NSZone?
  • Index(es):
    • Date
    • Thread