[antlr-interest] [C] reuse() - grow of RAM -- attempt #2.
Ruslan Zasukhin
ruslan_zasukhin at valentina-db.com
Fri Nov 18 14:36:03 PST 2011
Hi Jim,
So I have debug debug and have found that
=================
1) Generated Parser contains ctx->adaptor, which contains one more
tokenFactory. And for this factory NEVER is called reset().
I have add call reset() for now in the method of generated parser.
This have made things better, but still I see at least two players...
So next player is:
=================
2) This adaptor also has more deeply hidden factory of trees.
And it is called a lots for nilNode().
And this factory
typedef struct ANTLR3_ARBORETUM_struct
Although is very similar to
typedef struct ANTLR3_TOKEN_FACTORY_struct
In work with pools, it do NOT have reset() function.
So I think I will try add reset() method to this struct,
And call it from generated parser reset() method as following
static void
SqlParser_v3ParserReset (pSqlParser_v3Parser ctx)
{
RECOGNIZER->reset(RECOGNIZER);
// RZ added this to see if this fixes grow of RAM.
ADAPTOR->tokenFactory->reset( ADAPTOR->tokenFactory );
((pANTLR3_COMMON_TREE_ADAPTOR)(ADAPTOR->super))->arboretum->reset(
(ADAPTOR->super))->arboretum);
}
--
Best regards,
Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc
Valentina - Joining Worlds of Information
http://www.paradigmasoft.com
[I feel the need: the need for speed]
More information about the antlr-interest
mailing list