Beginner Question Re: Memory Management
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