Re: Inconsistent Memory Management Rules
Re: Inconsistent Memory Management Rules
- Subject: Re: Inconsistent Memory Management Rules
- From: David Blanton <email@hidden>
- Date: Sun, 13 Apr 2003 22:19:35 -0600
On 4/13/03 9:59 PM, "mmalcolm crawford" <email@hidden> wrote:
>
>
On Sunday, April 13, 2003, at 11:54 AM, David Blanton wrote:
>
>
> I have an example that contradicts the rules I have read for Cocoa
>
> memory
>
> management.
>
>
>
> One rule as I understand it is "If you -alloc, then you -release (or
>
> -autorelease)"
>
>
>
> I have code that crashes when using this rule as follows:
>
>
>
> NSString * string = [[NSString alloc]init];
>
> string = [string stringByAppendingString:@"steve jobs"];
>
>
>
> ... More of the same
>
>
>
> [anIBOutlet setStringValue:string];
>
> [string release]; // always crashes
>
>
>
> Can someone explain this inconsistency?
>
>
>
You've reassigned string...
>
>
mmalc
>
Thanks to all who responded. I misunderstood stringByAppendingString.
--
David Blanton
"Cocoa FNG"
_______________________________________________
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.