Will this cause a leak?
Will this cause a leak?
- Subject: Will this cause a leak?
- From: "Zameer Andani" <email@hidden>
- Date: Wed, 27 Jul 2005 11:06:07 -0700
- Thread-topic: Composite values using Core Data and Cocoa Bindings
I'm a little confused with the concept of autorelease, I've read all the documentation about the topic that has been posted thus far in the forum and I find myself still confused. Can someone perhaps still clarify.
For example if I had the following:
-(NSString*) Foo
{
NSString *myString = [[NSString alloc] initWithString:@"This is a test"]; //at this point retainCount = 1
return [myString autorelease]; //Have I leaked?
}
>From experimentation, I have found that autorelease does not decrement the retain count, if anything it will increment the retain count.
So do I need to explicitly call [release] on the object before returning out of the method? Should my code be changed to look like:
[myString autorelease];
[myString release];
return myString
thanks for the help...
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden