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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:53:00+00:00 2026-05-17T21:53:00+00:00

I am too dumb to know the answer to this one – does anyone

  • 0

I am too dumb to know the answer to this one – does anyone know the answer definitively?

NSMutableArray *happyDictionaryEntries;
@property (nonatomic, retain) NSMutableArray *happyDictionaryEntries;

-(void) getStuffFromServer
 {
 ..
 self.happyDictionaryEntries = [NSMutableArray
  arrayWithContentsOfURL:[NSURL URLWithString:aUrl]];
 }

Later we will release the array. I want to actually release all the elements of the array.

So, we would [happyDictionaryEntries release].

(Or I suppose just self.happyDictionaryEntries = nil since it’s a property.)

BUT do you also have to [happyDictionaryEntries removeAllObjects] ?

AND/OR do you have to release each item in the array manually?

(Indeed – associated question – does anyone know if removeAllObjects in fact releases each object? It’s not really clear what the situation is.) Is there an idiom?

I can manage memory no problem in a typical array that you build up “yourself”, but I’m too dumb to understand what the situation is when you have arrayWithContentsOfURL in the mix. If anyone definitively knows the answer, thanks!

“The documentation for NSArray & NSMutableArray state the memory management behavior – Joshua”

Correct. Do you have any documentation for removeAllObjects or for arrayWithContentsOfURL? Can anyone decisively state what removeAllObjects does? Thanks.

“From Apple’s Memory Management Programming Guide: [well-known quite form the doco]”-jlehr.

Correct, but what does removeAllObjects do? Does anyone know?

NOTE THAT there is NO documentation on that. The doc on NSMutableDisctionary removeAllObjects for example IS explicit. BUT the doc on NSMutableArray removeAllObjects noticably SAYS NOTHING. It could be like (to make one example) imageNamed which basically doesn’t work and does not work as one would expect.

  • 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-17T21:53:00+00:00Added an answer on May 17, 2026 at 9:53 pm

    Yes, NSArray, NSSet and NSDictionary classes all retain the objects held in them. When the NSArray, NSSet or NSDictionary object’s retain count reaches zero, the retained objects are all released as part of the dealloc. removeAllObjects will also release all the held objects.

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

Sidebar

Related Questions

I hope this question isn't too dumb. We have many websites internally that need
this is probably a dumb question, but wasnt too sure what else to do.
yes i know how silly and dumb this question is, but i have been
Answer: This was a dumb mistake, was using '//' for single line comments instead
I know this seems like a dumb question but how do I search a
Here's one from the No question's too dumb department: Well, as the subject says:
I think it's simple but I am too dumb to write one. Can someone
I'm hoping this isn't too dumb a question: I just started using MVVM light
Not too sure what's going on here as this doesn't seem like standard practise
Not too sure how to formulate my question and I hope that this is

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.