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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:37:22+00:00 2026-05-13T19:37:22+00:00

I would expect that after I push a view controller I then need to

  • 0

I would expect that after I push a view controller I then need to release my ownership of the view controller like I did below.

CustomViewController *nextViewController = [[CustomViewController alloc] initWithNibName:@"CustomView" bundle:nil];
[[self navigationController] pushViewController:nextViewController animated:YES];
[nextViewController release];

After I do that, I assume that the navigation controller has ownership of that object and will release it when done which would then call dealloc on my customViewController. I would expect that to happen when I tap the back button on the navigation bar and the view is no longer displayed. That does not happen though. I added an NSLog(@”CustomViewController did receive dealloc”) into the dealloc method of CustomViewController but it never gets printed. Is this normal behavior?

Is the navigation controller just doing something like keeping that object in case it needs it at some point? Will it get rid of it when memory starts to run out? I tried simulating a low memory warning but nothing happens. I have a feeling the answer to this question will be that I should just not worry so much and follow the standard procedure for retain/release/autorelease. That said though, has any one else delved into this a little bit further and found out an absolute answer?

  • 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-13T19:37:22+00:00Added an answer on May 13, 2026 at 7:37 pm

    “Is the navigation controller just doing something like keeping that object in case it needs it at some point?”

    Yup. That is exactly what it is doing. It will send you viewDidLoad and viewDidUnload messages though. And that is the place where you should allocate and free resources that your viewcontroller uses.

    Note that viewDidUnload will only be called when the system thinks it needs to free memory.

    If you need more immediate control over when things are loaded and freed then a better place might be viewWillAppear: and viewDidDisappear:.

    My alloc/init methods for viewcontrollers are usually pretty empty or not even there.

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

Sidebar

Related Questions

For example, if I make a query like between(1,4,X)? I would expect something like
Would having a nice little feature that makes it quicker to write code like
(please excuse that I didn't use aliases). I would like my query output to
Using any tools which you would expect to find on a nix system (in
Would I expect to see any performance gain by building my native C++ Client
Using groovy, would you expect better performance in terms of speed and memory overhead
Haven't fired up reflector to look at the difference but would one expect to
I would expect the block in the second 'if' statement to be entered because
I would like to update my SQL lite database with the native update-method of
I would like to get a sum from a column, with and without 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.