AGRegex Memory Hog Bug
AGRegex Memory Hog Bug
- Subject: AGRegex Memory Hog Bug
- From: Aram Greenman <email@hidden>
- Date: Sun, 7 Sep 2003 16:23:36 -0700
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:
1. Retain instead of copy the target string, and warn that the target
string shouldn't be modified while the match is being used. But, I
don't really like this idea since it can't be enforced.
2. Add something like +setCopiesTargetString: so the user can choose
whether to copy or retain target strings at runtime.
3. Deprecate or remove -[AGRegexMatch group], -[AGRegexMatch
groupAtIndex:], and -[AGRegexMatch groupNamed:], then there would be no
need to copy the target string in the AGRegexMatch at all. This is the
solution I'm leaning towards since these are just convenience methods
anyway; you can do the same thing with [theTargetString
substringWithRange:[theMatch range]].
Any other ideas, I'm glad to hear them.
Thanks,
Aram
_______________________________________________
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.