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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:21:30+00:00 2026-06-12T06:21:30+00:00

I added some logging to all of my init s and dealloc s to

  • 0

I added some logging to all of my inits and deallocs to try to understand why my ARC-enabled project was consuming more and more memory as runtime continued. I found that one view controller was responsible. It’s main duty at initialization is to create an NSMutableArray and fill it with NSNull objects. During execution, it swaps out these null objects for more meaningful objects, and vice versa – a basic lazy loading setup.

When this view controller is popped, any non-null views that are in the NSMutableArray at that time are not released. As a result, the view controller itself is also not released.

I can resolve this by either emptying the NSMutableArray or setting it to nil.

What makes this necessary? Is it always my responsibility to set an array to nil if I created it, even under ARC? Or must something else be retaining one of the objects in the array, and preventing it from automatically deallocating?

  • 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-06-12T06:21:31+00:00Added an answer on June 12, 2026 at 6:21 am

    Assuming the NSMutableArray is an instance variable, it should be released when the view controller is released. If your controller’s dealloc is getting called when the NSMutableArray only has NSNull objects, but it’s not getting deallocated when you fill your array with “meaningful” content, that means that you undoubtedly have a strong reference cycle, i.e. there must be some reference to the view controller, itself, in the contents of the NSMutableArray.

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

Sidebar

Related Questions

I have some questions about logging, more specifically about setting it up and making
I added some columns to a table using rails and rake, but they do
I added some UI elements to the main.xml file in the res\layout folder and
I added some custom products in virtuemart from my custom component and added its
I added some commands to produce an output file in methods of a given
I've added some buttons to an UIView (via addSubview) programmatically. However, they appear as
I have added some settings to my c# application using the configuration editor. There
I've added some php flags in my htaccess in order to change some php
I recently added some url re-writing to my web application and had to added
I have added some animation using jquery but it's not working: $('.test-container').click(function(){ $(this).css('background-color', 'rgb(119,

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.