• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Beginner Question Re: Memory Management
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Beginner Question Re: Memory Management


  • Subject: Beginner Question Re: Memory Management
  • From: Daniel Torrey <email@hidden>
  • Date: Mon, 22 Jun 2009 16:39:05 -0400

Hi,

I'm looking at some sample iPhone code, and in the app delegate's applicationDidFinishLaunching method, I see

// Set up the view controller
MyViewController *aViewController = [[MyViewController alloc] initWithNibName:@"HelloWorld" bundle:[NSBundle mainBundle]];
self.myViewController = aViewController;
[aViewController release];


I'm a little confused - I see an allocation, followed by an assignment, followed by a release. I think that the assignment is really a call to a setter - the myViewController field is created automagically using the @property/@synthesize syntax.

Since a release was sent to aViewController, what keeps that object from being nuked at the end of the run loop? There must be another retain happening somewhere, right?

Second question - is there anyway to see the code that gets generated by @synthesize? I'm nosy and curious.

Thanks,
Daniel


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Beginner Question Re: Memory Management
      • From: Ken Thomases <email@hidden>
    • Re: Beginner Question Re: Memory Management
      • From: "Henry McGilton (Boulevardier)" <email@hidden>
    • Re: Beginner Question Re: Memory Management
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: Card Game (like Spider-Solitaire) in Cocoa -- Conceptual ideas needed
  • Next by Date: IKImageBrowserView setSelectionIndex not selecting
  • Previous by thread: Re: Programmatically Accessing Core Data Localization Strings
  • Next by thread: Re: Beginner Question Re: Memory Management
  • Index(es):
    • Date
    • Thread