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

  • Home
  • SEARCH
  • 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 6147261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:04:48+00:00 2026-05-23T19:04:48+00:00

I found an answer to this a while ago, and made a mental note

  • 0

I found an answer to this a while ago, and made a mental note to fix it, but now I can’t for the life of me find the post again.

Very simple – my current method for adding dictionaries to an array is leaky. Please, what is the best way to ensure they are being released properly? My method:

[beachPresenters addObject:[[NSMutableDictionary alloc]initWithObjectsAndKeys:
                                @"Kayak rides",@"name",@"kayak_sm.png",@"smPhoto",@"kayak_med",@"medPhoto",@"Free kayak rides for kids",@"description",@"",@"Friday",
                                @"All day! 10.00am - 6.00pm",@"Saturday",@"",@"Sun",@"Beach",@"stage",@"Blah blah blah",@"blurb",nil]];
  • 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-23T19:04:49+00:00Added an answer on May 23, 2026 at 7:04 pm

    beachPresenters (I assume it’s an array) takes ownership of the dictionary, so the +1 to the reference count caused by +alloc/-init of the dictionary is not balanced. Thus, the dictionary is leaked.

    Use the convenience method equivalent to balance the retain:

    NSDictionary *presenter = [NSDictionary dictionaryWithObjectsAndKeys: ...];
    [beachPresenters addObject: presenter];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been searching for a while but couldn't find a definite answer to this
I've been looking for this for a while, but haven't found an answer (blame
(I found the answer to this elsewhere while writing the question, but I thought
This took me a while to figure out and I found the answer on
I haven't found an answer to this particular question; perhaps there isn't one. But
I searched and found this question but did not like the answer. Is there
A few days ago, this was my question, and I found the answer. Maybe
I've been looking for a solution to this for a while now, have found
While searching for an answer to this question I found this sample code which
I've been looking around for a while for an answer to this, but haven't

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.