Re: autorelease use...
Re: autorelease use...
- Subject: Re: autorelease use...
- From: Charilaos Skiadas <email@hidden>
- Date: Mon, 18 Jul 2005 11:46:59 -0500
On Jul 18, 2005, at 9:20 AM, Tristan O'Tierney wrote:
- ( void ) myFunction {
NSString *str = [NSString stringWithString: @"my string"];
[str retain];
}
Unless I'm mistaken, this will leak, no? str is a local variable
declared in the function, so it is lost the moment you exit the
function, and the retained object sticks around forever. I am
guessing what you meant was the same without NSString * in front,
where it is assumed that str is an instance variable of the object in
question?
Or have I gotten it all wrong?
To Luc: Joar's email really nailed the issue. You should think of
memory management in terms of ownership. Should your object own the
other object or not?
Haris
_______________________________________________
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