[antlr-interest] Exception in thread"main" java.lang.OutOfMemoryError: Java heap space

siva.kumar at loglogic.com siva.kumar at loglogic.com
Thu Jun 19 14:05:49 PDT 2008


Thanks for your suggestion, Jim.

The only place that I use/refer to the objects is in the parser in code:

keyvaluetokens  : ID EQ STRING COMMA
                {
                        String mykey = $ID.text;
                        System.out.println("ID IN TABLE= " + $ID.text + ",VALUE=" + $STRING.text) ;
                }
                ;

(The entire grammar is at:
http://pastie.textmate.org/218178
)

Will try to switch to C and see what happens. :-)

Thanks,
-Siva

________________________________________
From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Jim Idle
Sent: Thursday, June 19, 2008 10:38 AM
To: antlr-interest at antlr.org
Cc: antlr-interest at antlr.org
Subject: Re: [antlr-interest] Exception in thread"main" java.lang.OutOfMemoryError: Java heap space

On Thu, 2008-06-19 at 10:30 -0700, siva.kumar at loglogic.com wrote: 

I have a simple grammar at:

http://pastie.textmate.org/218178

The LOG file that's parsed is of the form:

ABCD="....", EF="aaaa", abcd="1.2.3.4",hostname=a at b.com,

While I build and run this using antlr and java, I get the "Java heap
space" problem on a very large file (70M). I don't have a problem with
smaller files

Try using the -Xincgc option with your runtime, but are you doing anything that would cause the runtime to try and create huge strings such as the entire input lots of times in the lexer, or calling the routine that produces the dot spec for graphviz (that blows up after the number of nodes gets somewhat large. Or creating objects and  references and then never freeing up the references to these objects?

You could always switch to the C output, where you could at least find out where the memory was going to ;-)

Jim 


More information about the antlr-interest mailing list