Re: AGRegex Memory Hog Bug
Re: AGRegex Memory Hog Bug
- Subject: Re: AGRegex Memory Hog Bug
- From: Michael Tsai <email@hidden>
- Date: Sun, 7 Sep 2003 19:48:16 -0400
On Sunday, September 7, 2003, at 07:23 PM, Aram Greenman wrote:
If you're using AGRegex <http://sf.net/projects/agkit/>, you may have
noticed that it sucks a lot of memory when matching against a large
target string (thanks to Ben Dougall for pointing this out). This is
because it copies the target string into the AGRegexMatch instance. I
chose to copy, rather than retain, the target string so the
AGRegexMatch would still be able to return groups even if the target
string was later modified, but unfortunately this leads to an
unacceptable level of memory use in certain cases. Since this can't be
repaired without a behavior or API change or both, I'm soliciting
comments on the possible fixes:
I think you can preserve the existing behavior and API. Copy the target
string once, and do the UTF-8 conversion once (or maybe just the
latter). Let all the matches share the same immutable string. Make
-findAllInString:range: use PCRE directly rather than calling
-findInString:range:. That should bring it down from n^2 to n.
--
Michael Tsai <
http://www.c-command.com>
_______________________________________________
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.