Re: [newbie] NSString code so it won't leak
Re: [newbie] NSString code so it won't leak
- Subject: Re: [newbie] NSString code so it won't leak
- From: Ondra Cada <email@hidden>
- Date: Tue, 10 Sep 2002 20:42:22 +0200
On Tuesday, September 10, 2002, at 03:58 , Dean Davis wrote:
NSString *string1,*myString
string1 = [myString stringToIndex:41];
myString = [myString stringFromIndex:41];
This works but leaks.
It not only works; also, it does not leak. Read memory management, focus
on autoreleasing.
myString = [myString2 stringFromString:myString2];
// or? myString = [myString2 copy];
[myString2 release];
This would crash, on the other hand.
---
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.