[antlr-interest] "java.lang.OutOfMemoryError: Java heap space" error message (newbie)
Randall R Schulz
rschulz at sonic.net
Sun Jul 15 08:47:00 PDT 2007
Ali,
Please maintain proper message quoting characters. Without them, it
becomes difficult to sort out successive reply text from the text being
replied-to.
On Sunday 15 July 2007 08:14, ali azimi wrote:
> Randall R Schulz <rschulz at sonic.net> wrote:
> >
> > On Sunday 15 July 2007 07:33, ali azimi wrote:
> > > Hello,
> > >
> > > I am still not able to increase the heap space. I keep getting
> > > "java.lang.OutOfMemoryError: Java heap space" error message once
> > > I click on the debugger. I use the the command "java -Xms32m
> > > -Xmx512m org.antlr.Tool RFC3986.g" but then face the following
> > > error message: "Exception in thread "main"
> > > java.lang.NoClassDefFoundError:org/antlr/Tool". I use
> > > ANTLRWorks_1.0.201.
> > > Could you please suggest me an easy way of sorting this
> > > out(increasing the heap space). I will be very grateful.
> >
> > You're not dealing with an out-of-memory condition. You're invoking
> > the JVM without properly telling it where your ANTLR libraries (JAR
> > files) are located.
> >
> > Please show us the command you're using to attempt to launch
> > ANTLRWorks with the -X options.
> >
> I do not use any commands to launch ANTLRWorks. I simply
> double-click on the jar file (ANTLRWorks_1.0.201.jar) which is
> located on my computer desktop. I use the command java -Xms32m
> -Xmx512m org.antlr.Tool RFC3986.g in an attempt to increase the
> heap space.
I'm not sure I understand what you're doing. Which program is exceeding
its heap allocation? ANTLRWorks or ANTLR invoked on the command line?
This command:
java -Xms32m -Xmx512m org.antlr.Tool RFC3986.g
(setting aside the missing class-path arguments and the fact that such
an invocation could never successfully launch anything) is an
invocation of the ANTLR tool, the program that takes ANTLR grammars and
produces target parser (and / or lexer, etc.) source code that in turn
implements the grammar specified in the ".g" file.
This is _not_ an invocation of ANTLRWorks.
If ANTLRWorks (which is self-contained) is running out of memory, then
you'll have to launch _it_ with the -X... memory options. If ANTLR is
running out of memory when processing your grammar, then you must
launch _it_ with the memory options _and_ its classpath. This precludes
simply double-clicking the JAR file, which will use only default JVM
parameters, including its default memory limits.
Randall Schulz
More information about the antlr-interest
mailing list