Re: MOKit memory problem
Re: MOKit memory problem
- Subject: Re: MOKit memory problem
- From: Nico <email@hidden>
- Date: Mon, 12 Aug 2002 09:30:06 +0200
Here's the code I use :
- (NSDictionary *)parse:(NSString *)string
{
NSString *myInfo1, *myInfo2;
MORegularExpression *regexp;
if ([[MORegularExpression regularExpressionWithString:@".* some RE .*?
:.*"] matchesString:string])
{
regexp = [MORegularExpression regularExpressionWithString:@"(.*) some
RE (.*?) :(.*)"];
myInfo1 = [regexp substringForSubexpressionAtIndex:1
inString:string];
myInfo2 = [regexp substringForSubexpressionAtIndex:2
inString:string];
} else if ... // here I verify whether the string matches another regexp
{
} else if ... {
// etc..
}
// i return an NSDictionary* created using the strings (myInfo1 and/or
myInfo2, and many others)
}
(regexp is used only is the currend method, which is called each time a new
data is read from a socket. This method is used to match what kind of info
we've just retrieved from an IRC server)
MallocDebug indicates the major part of the memory is allocated for
MORegularExpression.
Please tell me if I didn't something *WRONG* :]
Thanks you :>
Nico
On 12/08/02 3:30, "Brock Brandenberg" <email@hidden> wrote:
>
Hundreds? It certainly isn't a lightweight class, so it's understandable
>
that it will use RAM. How are you using the regex objects? Are you keeping
>
hundreds around for the life of the program or are you creating, using, and
>
releasing numerous times?
>
>
Brock
_______________________________________________
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.