Simple memory problem
Simple memory problem
- Subject: Simple memory problem
- From: harry greenmonster <email@hidden>
- Date: Thu, 5 Feb 2009 23:39:14 +0000
while([inputString isMatchedByRegex:regexString]){
range = [inputString rangeOfRegex:regexString];
inputString = [inputString stringByReplacingCharactersInRange:range
withString:@""];
}
'inputString' is a 5mb text file, Activity Monitor shows that memory
increases by about 9mb per iteration. Which quickly becomes a serious
problem.
I'm a little confused as to why I have a problem. My understanding is
that 'inputString' (on the third line) is replaced by the modified
version of itself. I was expecting the memory footprint for the app to
reduce in size (if anything). Obviously I have the concept
fundamentally wrong in my head.
a pointer address when replaced by another address free's up the old
memory location it once pointed to, no?
By the way I'm using RegexKit. And I'm a little rusty as have not
programed the mac for some considerable time.
_______________________________________________
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