Re: Simple memory problem
Re: Simple memory problem
- Subject: Re: Simple memory problem
- From: harry greenmonster <email@hidden>
- Date: Fri, 6 Feb 2009 00:20:56 +0000
"NSMutableString", good idea, I think that will work, will try that
thanks.
And thanks everyone else.
On 6 Feb 2009, at 00:16, Shawn Erickson wrote:
On Thu, Feb 5, 2009 at 3:39 PM, harry greenmonster
<email@hidden> wrote:
'inputString' is a 5mb text file,
Since inputString is large you really should avoid causing it to be
copied over and over again which -[NSString
stringByReplacingCharactersInRange:withString:] is doing. You should
instead use a mutable string and -[NSMutableString
replaceCharactersInRange:withString:].
NSMutableString* tmpString = [[inputString mutableCopy] autorelease];
while([tmpString isMatchedByRegex:regexString]) {
range = [tmpString rangeOfRegex:regexString];
[tmpString replaceCharactersInRange:range withString:@""];
}
-Shawn
_______________________________________________
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