[antlr-interest] Memory issue while lexer initialization

Terence Parr parrt at cs.usfca.edu
Fri Dec 28 10:10:42 PST 2007


hi. you must have one huge grammar.  Do you have a lexer with a  
million tokens?
Ter
On Dec 28, 2007, at 6:19 AM, elango m wrote:

> Hi,
>
> I have a memory issue when I create an instance of the lexer (new  
> MyLexer(new ANTLRStringStream("expression")). The following code in  
> the lexer creates instances of short[] with a huge data, consuming  
> more than 25 Mb. I don't understand why it requires such a huge  
> memory. Any help is appreciated.
>
>     static {
>         int numStates = DFA14_transitionS.length;
>         DFA14_transition = new short[numStates][];
>         for (int i=0; i<numStates; i++) {
>             DFA14_transition[i] = DFA.unpackEncodedString  
> (DFA14_transitionS[i]);
>         }
>     }
>
> Thanks,
> --Elango M
>



More information about the antlr-interest mailing list