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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:38:49+00:00 2026-05-23T07:38:49+00:00

Over here http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/TabBarControllers/TabBarControllers.html at listing 4.1 – (void)applicationDidFinishLaunching:(UIApplication *)application { tabBarController = [[UITabBarController alloc]

  • 0

Over here
http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/TabBarControllers/TabBarControllers.html

at listing 4.1

    - (void)applicationDidFinishLaunching:(UIApplication *)application {
       tabBarController = [[UITabBarController alloc] init];

       MyViewController* vc1 = [[MyViewController alloc] init];
       MyOtherViewController* vc2 = [[MyOtherViewController alloc] init];

       NSArray* controllers = [NSArray arrayWithObjects:vc1, vc2, nil];
       tabBarController.viewControllers = controllers;

       // Add the tab bar controller's current view as a subview of the window
       [window addSubview:tabBarController.view];
    }

The view controllers are alloced but not released. Shouldn’t there be a release of vc2 and vc2 after they’ve been added to the array?

  • 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-23T07:38:49+00:00Added an answer on May 23, 2026 at 7:38 am

    Unless I’m missing something, you’re right that vc1 and vc2 should be released. The method you posted allocs the view controllers, so it should either save them in instance variables so that they can be released later, or it should go ahead and release them after adding them to the array.

    In a practical sense, it really doesn’t matter much, however. In a tab-based app, the view controllers associated with the tab controller usually stick around for the life of the app. When the app terminates, those objects will be cleaned up anyway. This also isn’t quite a leak, since the tab controller still has references to the objects pointed to by vc1 and vc2, but it’s about as close to leaking as you can get without becoming a true leak.

    Good eyes, though. You should consider filing a bug with Apple about that.

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

Sidebar

Related Questions

http://developer.apple.com/library/ios/#samplecode/Touches/Introduction/Intro.html I'm new to IOS development, and have been playing around with the IOS
In articles like this: http://aaronparecki.com/How_to_Distribute_your_iOS_Apps_Over_the_Air as well as the official Apple Documentation: http://developer.apple.com/library/ios/#featuredarticles/FA_Wireless_Enterprise_App_Distribution/Introduction/Introduction.html it
I was reading over the tutorial here: http://www.1keydata.com/sql/sql-running-totals.html and it all made sense until
I've followed the tutorial here: http://developer.android.com/resources/tutorials/views/hello-gridview.html I'm wondering how I get place text over
I'm trying to match the hover over the contenteditible section here: http://html5demos.com/contenteditable This is
I get one tutorial over here http://codeigniter.com/forums/viewthread/122597/P0/ everything is find but not the pagination
You can see my issue here: http://pmind.com/staging/123.html I've tested this in Chrome, Safari, Firefox
I have an Exchange 2007 configured with ActiveSync and RPC over HTTP. Here are
Our client-server product has the protocol between them as XML over HTTP. Here, the
I have 'Back Board' on my images and content over here: http://syndex.me So basically,

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.