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 3270948
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:41:04+00:00 2026-05-17T18:41:04+00:00

Does anyone have advice on how to best initialize an NSMutableArray when it comes

  • 0

Does anyone have advice on how to best initialize an NSMutableArray when it comes to dictating the capacity? The documentation mentions that “…even though you specify a size when you create an array, the specified size is regarded as a “hint”; the actual size of the array is still 0.” So…

1) If I init with a greater capacity than I typically use, do I not have to worry about wasted memory?

2) If I init with a capacity typically lower than what I use, do I have to worry about heavier processing time allocating more memory to hold the extra elements?

Just how impacting is this initialized capacity to the performance/memory usage of this data type?

  • 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-17T18:41:05+00:00Added an answer on May 17, 2026 at 6:41 pm

    Whether any space is wasted by giving too big a capacity is actually an implementation detail that Apple deliberately doesn’t expose, I guess. NSMutableArray is a class cluster which means you don’t actually get an instance of NSMutableArray but some other, specialized class following the same interface. And Apple doesn’t tell you which class gets returned in which case and how it’s behaving. So it’s hard to give real advices here.

    If you really know that on average you’ll need a capacity of X, just use it. Otherwise, unless you have performance problems I wouldn’t care about the capacity at all and just use [NSMutableArray array]…

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

Sidebar

Related Questions

I have a webpage that reads data from an external source. It can take
I'm still in need of help. I have website settings that I want to
I do start off organising my .h files with the best intentions but somehow
This is a follow on from IPhone App Submission Issues If I have a
Due to 0 responses, I'm guessing that my LEFT JOIN question got into too
Basically I need some text like: I have an ice cream cone. You are
I really hope someone can advise on displaying a google map from a hidden
I am trying to deploy our images to a cdn. Currently the css has
Is there a online version of the k-Means clustering algorithm? By online I mean
I'm writing some code to translate a C++ type to an appropriate type for

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.