Re: AGRegex Memory Hog Bug
Re: AGRegex Memory Hog Bug
- Subject: Re: AGRegex Memory Hog Bug
- From: publiclook <email@hidden>
- Date: Sun, 7 Sep 2003 21:27:12 -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 would just modify the documentation to warn people that if they
provide a MUTABLE string memory usage might be high due to copying of
the string. This should not be a problem for immutable strings because
they should/do implement -copy to simply retain. In other words, just
telling library users should be enough because the way to avoid the
problem is simple. Library users can just create their own (singe)
immutable copy before calling into the library. besides, they
shouldn't pass a mutable object to you anyway because as you say, you
can't have the string changing while the library is still using it.
_______________________________________________
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.