Object Ownership
Object Ownership
- Subject: Object Ownership
- From: Michael Jackson <email@hidden>
- Date: Sat, 22 May 2010 09:18:22 -0600
Hi all,
First day with Cocoa, so please excuse the basic newbness of this
question. ;) I've read through the documentation about object
ownership and disposal and just wanted to make sure I'm doing
everything correctly in the following method.
- (NSURL *)makeURL:(NSString *)aURLString
{
NSMutableString *aCopy = [aURLString mutableCopy];
// do some stuff with aCopy here
NSURL *aURL = [NSURL URLWithString:aCopy];
[aCopy release];
return aURL;
}
The question is whether or not NSURL's URLWithString: is going to
retain aCopy, so it's safe to be released on the next line. I'm just
looking for some confirmation or any pointers from people who are more
used to managing memory than I am.
Thanks,
Michael
--
Michael Jackson
http://mjijackson.com
@mjijackson
_______________________________________________
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