Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5949197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:12:54+00:00 2026-05-22T17:12:54+00:00

There are so many functions like 1. NSDefaultMallocZone() 2. NSCreateZone(); 3. NSRecycleZone(); 4. NSSetZoneName();

  • 0

There are so many functions like

1. NSDefaultMallocZone()
2. NSCreateZone();
3. NSRecycleZone();
4. NSSetZoneName();
5. NSZoneMalloc();
and many more related to NSZone

What does NSZone means, where to use these functions and when?
What are the advantages of initWithZone: and how to use in my iphone app?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:12:55+00:00Added an answer on May 22, 2026 at 5:12 pm

    NSZone is Apple’s way of optimizing
    object allocation and freeing. NSZone
    is not an object; it is an opaque
    C-struct storing information about how
    memory should be handled for a set of
    objects.

    One rarely needs to worry about
    handling your own zones in
    applications; Cocoa handles it
    transparently. A default NSZone is
    created on startup and all objects
    default to being allocated there. So
    why would you want to use your own?

    If you are mass-allocating hundreds of
    cheap objects, you may find the cost
    of actually allocating space for them
    becomes significant. Because the
    standard zone is used all the time, it
    can become very patchy; deleted
    objects can leave awkward gaps
    throughout memory. The allocator for
    the standard NSZone knows this, and it
    tries to fill these gaps in preference
    to grabbing more memory off the
    system, but this can be costly in time
    if the zone has grown quite large.

    If you want to mass-allocate objects,
    then, you can create your own zone and
    tell it not to bother with finding
    gaps to put new objects in. The
    allocator can now jump to the end of
    its allotted memory each time and
    quickly assign memory to your new
    objects, saving a lot of effort.

    Allocators can save you time
    elsewhere, too, as asking the OS for
    more memory, which a zone needs to do
    whenever it fills up, is another
    costly operation if it’s done a lot.
    Much quicker is to ask for huge chunks
    of memory at a time, and you can tell
    your NSZone what to do here as well.

    Rumor has it that NSZone could save
    you deallocation time in the Good Old
    Days, too, with a method that simply
    chucks away all the allotted memory
    without bothering to call
    deallocators. If a set of objects is
    self-contained, this could save a lot
    of time, as you can chuck them all
    away at once without tediously
    deallocating them all. Alas, there
    appears to be no sign of this godsend
    in the current documentation; the
    single NSZone method (NSRecycleZone?)
    carefully puts all the objects in a
    zone neatly on the default NSZone. Not
    exactly a huge time-saver.

    So, in summary, zones save you time in
    mass allocations. But only if
    programmers know how to use them!

    From CocoaDev

    Edit from comments: "Also important to note is that you can’t use NSZone any more if you’re using ARC. Which you should be."

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hi i know there are many nice functions in wordpress like is_page() , is_single()
I'm learning GLES. There are many pair functions like glClientActiveTexture / glActiveTexture . What's
I have many functions like updateUser($id,$username,$email) updateMusic($id, $music) etc... Is there a generic function
There are many functions available in Windows API for usage, is there any book
I read many articles about unsafe functions like strcpy, memcpy, etc. which may lead
There are many functions within the code I am maintaining which have what could
Is there anything like Javadoc for documenting Fortran code? How does one document the
Many functions of a library I use return generator s instead of list s
For iPhone game development, seems there are very like functions using CALayer and UIView,
Suppose there is a input file. The file contains php class with many functions

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.