Re: Memory allocation questions
Re: Memory allocation questions
- Subject: Re: Memory allocation questions
- From: Ondra Cada <email@hidden>
- Date: Sun, 28 Jul 2002 18:12:57 +0200
On Sunday, July 28, 2002, at 08:21 , Nathan Day wrote:
- (void)setMainSprocket:(Sprocket *)newSprocket
{
[mainSprocket autorelease];
mainSprocket = [newSprocket retain]; /* Claim the new Sprocket. */
return;
}
You could,
Caveat. You could not.
I don't know why they choose to do it that way
For newSprocket might be the same object as mainSprocket, and it might
have a retain count of one, in which case you'd dealloc it first and use
afterwards, with all the potential havoc.
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
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.