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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:48:05+00:00 2026-05-29T09:48:05+00:00

When testing my app using Instruments -> Activity Monitor, I’m seeing a difference in

  • 0

When testing my app using Instruments -> Activity Monitor, I’m seeing a difference in memory use when a transition is done via the back button and follows the navigation controller vs calling a method in AppDelegate that uses pushViewController. If the navigation is completed by the navigation back button, then the memory use drops (I’m new to iOS programming, but I believe the term is that it’s releasing the subviews of that particular controller). If I navigate away from that view controller by using a method in AppDelegate that uses pushViewController , then the memory isn’t released and if you go back to that view controller, it starts adding up again. I’m working in XCode 4.2 writing for iOS5.

This is the method in AppDelegate:

-(void)applicationDidTimeout:(NSNotification *) notif
{
    UIViewController *controller = [[UIStoryboard storyboardWithName:@"MainStoryboard" bundle:NULL] instantiateViewControllerWithIdentifier:@"slideShow"];

    [[UIScreen mainScreen] setBrightness:0.0];
        NSLog(@"go home");
        [(UINavigationController *)self.window.rootViewController pushViewController:controller animated:YES];
}

The app flows like this: Main Page with 4 buttons. Button 1 pushes a UIViewController with a scrollview which has a subview (A). That subview also has a subview (B) with a close button. Hit the close button and subview(B) is removed from superview. Hit the back button on the top left and it returns to the Main Page. If you have no user interaction after a set period of time, the method above fires and send you to screenSaverViewController. Touch anywhere in the screen saver and you go back to Main Page.

When watching the Activity Monitor, the amount of memory being reported as used in the Real Memory Usage window increases every time a subview(B) appears, but doesn’t go down until you hit the back button and return to Main Page. If the screen saver kicks in, then it doesn’t go down at all.

Using either method, viewWillDisappear and viewDidDisappear both fire in the scrollview Controller. Why does one release memory and the other doesn’t?

All of my navigations work, it’s just a memory usage issue that I need assistance with.

Follow Up:

picciano pointed out what I wasn’t seeing – pushViewController does what it does. Pushes views on top of existing views. Can anyone suggest the proper replacement for pushViewController? The method has to fire from AppDelegate so that the app navigates from any view to the screen saver when the notification fires.

Solved:

What I ended up doing was moving the navigation from AppDelegate to the individual view controllers. I made sure to #import "Timer.h" and added my notification listener to viewDidLoad [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidTimeout:) name:kApplicationDidTimeoutNotification object:nil]; and then added the applicationDidTimeout: method:

-(void)applicationDidTimeout:(NSNotification *) notif
{
    [self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:1] animated:YES];
}

1, in this case, is my screen saver controller. 0 = the root view. These numbers follow the navigation stack. root view (0) -> screen saver (1) -> main page (2) -> 1 of 4 other pages

  • 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-29T09:48:05+00:00Added an answer on May 29, 2026 at 9:48 am

    pushViewController (like the name implies) add a new instance of a UIViewController into the navigation controller, increasing overall memory usage.

    The back button by contrast removes the top UIViewController from the navigation controller and releases memory.

    If you continue pushing view controller after view controller, you will eventually run out of memory and crash.

    Rethink your navigation.

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

Sidebar

Related Questions

For my iOS app tuning with instruments of xcode4, Using activity monitor Real memory
I just started using Instruments, a nice little tool for testing memory allocations/ leaks
I am testing the UI of my ASP.Net Web Forms app using NUnit/Watin. I
I'm using this django app to implement PayPal IPN. I'm testing it using PayPal's
Its a rails 2.3.5 app. I'm using the rspec and cucumber for testing. When
I'm testing an app that reads thousands of small objects and sends then back
I'm using Instruments with the Allocations instrument. I'm testing only a fixed interaction with
I am doing unit testing on my iPhone app using OCUnit on XCode 3.2.3,
I'm trying to access the request.user object when testing my app using django's client
I am testing an extjs web app by using robotframework and selenium2library, but I

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.