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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:40:11+00:00 2026-06-10T04:40:11+00:00

I have a MyViewController, it’s based on UIViewController, and I used it like the

  • 0

I have a MyViewController, it’s based on UIViewController, and I used it like the following code:

MyViewController *nextViewController = [[MyViewController alloc] init];
[self.navigationController pushViewController:nextViewController animated:YES];
[nextViewController release];

And in the MyViewController, with a user event, have the following code:

[self.navigationController popViewControllerAnimated:YES];

Now, I find that, the MyViewController’s dealloc don’t be called, but, when I switch the App to background, for example, pass the home button, the dealloc method has been called! This a big problem! There will be got a lot of MyViewController wouldn’t be release, when user go to a MyViewController, and go back, again and again, and just, the lots of memory could be release only when the App goto background.

So, can anyone help me about this, thanks!

  • 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-10T04:40:13+00:00Added an answer on June 10, 2026 at 4:40 am

    The obvious reason is that something is retaining your viewController. You will have to look closely at your code. Do you do anything that in your class that uses delegates, since they sometimes retain the delegate. NSURLConnection will retain your class, and so does NSTimer. You can scatter code in you class and log your class’s retain count, and try to find out where. In the code you showed so far the retain could should just be 1, since the class is only retained by the navigation controller.

    Also, before you pop your view, get a reference to it, pop it with NO animation, and then send it some message that has it report the retain count (this would be some new method you write). That new method could also log other things, like whether it has any timers going, NSURLConnections, etc.

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

Sidebar

Related Questions

I have the following code in a UIViewController subclass: MyViewController *viewController = [[MyViewController alloc]
I have a simple ViewController that looks like this: @interface MyViewController : UIViewController<UIScrollViewDelegate> {
I have a UIViewController subclass that accesses self.navigationController in viewDidLoad:. Depending on where it
I have something like this: myViewController = [[MyViewController alloc] initWithNibName:@MyView bundle:nil]; [mainCanvas addSubview: myViewController.view];
I have a .h file containing... myViewController : UIViewController {} in the .m file
If I have a uiviewcontroller with a instance variable direction. I can do MyViewController.direction
consider the following scenario: I have a storyboard-based app. I add a ViewController object
I have tried to run the following code, as a proof of concept, and
I have a UIViewController (MyViewController) and another view controller i'm presenting modally though MyViewController
I have an iPhone application and a navigationController . I do this: MyViewController *myVC

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.