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 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

Ask A Question

Stats

  • Questions 485k
  • Answers 485k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Note this is a warning (so it is dangerous not… May 16, 2026 at 7:47 am
  • Editorial Team
    Editorial Team added an answer Your clean method in the forms.py should return the self.cleaned_data,… May 16, 2026 at 7:47 am
  • Editorial Team
    Editorial Team added an answer you will use a ScrollView too, but you need embed… May 16, 2026 at 7:47 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.