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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:24:20+00:00 2026-05-26T15:24:20+00:00

my app involves many viewcontrollers, some of which are memory heave-duty ones. The user

  • 0

my app involves many viewcontrollers, some of which are memory heave-duty ones.

The user flow is like starting from a home viewcontroller, user will clicks through a sequence of viewcontrollers (i use presentModalViewControler for the transitions). Sometimes, user will click a menu bar or something to go back to a certain viewcontroller he/she went through in the past, or jump forward to a viewcontroller which hasn’t been presented yet. So, it’s like:
A->B->C->D->B->D->E->F->C->I…

What I am doing right now is: no matter where the user is, when he/she needs to jump over to some other viewcontroller, I simply instantiate the target viewcontroller, and present it as a modal viewcontroller.

Well, it works well, but with Instruments, I’ve identified the allocated memory heap keeps increasing since app launches. My guess is that the parentViewController(or presentingViewController in iOS 5) never get released because it’s in the root or middle of the modal presenting stack, so it’s like keep adding viewcontroller instances.

Therefore, I realize I’m doing it wrong. I would appreciate if anyone can point me to a right direction of doing apps like this.

  • 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-26T15:24:21+00:00Added an answer on May 26, 2026 at 3:24 pm

    When you present a view controller modally, the parent view controller stays around. That’s why your memory usage grows every time the user navigates to another view controller.

    Try using a UINavigationController as your window’s root view controller. Use your A view controller as the nav controller’s root view controller. Then, when you want to go to your B view controller, do it like this (in some method of your current view controller):

    UIViewController *b = [[BViewController alloc] init...];
    [self.navigationController setViewControllers:[NSArray arrayWithObject:b] animated:YES];
    

    As long as you don’t keep any other references to your A or B view controllers, they should be deallocated when they’re no longer visible.

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

Sidebar

Related Questions

I'm writing an app which involves arithmetic with humongous numbers, with very many digits.
my app involves some work with the camera, therefore it needs to handle capturing
I work on a web app that involves scheduling. A user can view his
I'm writing an app which for various reasons involves Internet Explorer (IE7, for the
I'm writing an app to help facilitate some research, and part of this involves
I am working on an iPhone app which involves using json-framework.I am getting array
I'm tracking how many activites are currently visible in my app (which should be
Am working on a gae app using python. The app involves some crowd-sourced data
My app involves a scrollView containing imageViews chosen by the user through a modified
I have an app in dev that involves a small list of people, a

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.