Re: Cocoa - Naive questions about memory
Re: Cocoa - Naive questions about memory
- Subject: Re: Cocoa - Naive questions about memory
- From: lbland <email@hidden>
- Date: Sun, 4 May 2003 18:27:51 -0400
On Sunday, May 4, 2003, at 05:58 PM, publiclook wrote:
- (void)setMainSprocket:(Sprocket *)newSprocket
{
[mainSprocket autorelease];
mainSprocket = [newSprocket retain]; /* Claim the new Sprocket. */
return;
}
It could have been written as the following:
- (void)setMainSprocket:(Sprocket *)newSprocket
{
[mainSprocket autorelease];
mainSprocket = [newSprocket copy]; /* Copy the Sprocket. */
}
no ... the first is a shared instance which when changed changes across
the entire object graph. The 2nd could be a localized object trunk node.
-lance
Lance Bland
mailto:email@hidden
VVI
888-VVI-PLOT
http://www.vvi.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.