[antlr-interest] Out of memory error

Mark Bednarczyk voytechs at yahoo.com
Thu Mar 15 03:35:50 PDT 2007


BTW: that AntSecurityException that is reported is due to the fact that
Tool.main() calls "System.exit(0);" at the end and tries to prematurely exit
the VM and ANT doesn't like that.

    public static void main(String[] args) {
		ErrorManager.info("ANTLR Parser Generator  Version " +
						  VERSION + " (Jan 31, 2007)
1989-2007");
		Tool antlr = new Tool(args);
		antlr.process();
		System.exit(0);
	}

So just removing that exit call gets rid of the anoying security exception.

Cheers,
mark... 

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org 
> [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Mark Bednarczyk
> Sent: Thursday, March 15, 2007 6:22 AM
> To: 'Terence Parr'; 'ANTLR Interest'
> Subject: Re: [antlr-interest] Out of memory error
> 
> I verified that the ANTLR3 task is not allocating enough 
> memory by running the ANTRL Tool directly in a controlled VM. 
> Then my more complicated grammar compiles.
> 
> So I'm back to my original question. Does anyone know how to 
> increase the memory limit on the optional ANTLR3 task? 
> 
> I'm currently calling ANTLR tool using a separate VM, but I 
> get these anoying "Security" warnings that have been discussed before.
> 
> Cheers,
> mark... 
> 
> > -----Original Message-----
> > From: antlr-interest-bounces at antlr.org 
> > [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Terence Parr
> > Sent: Wednesday, March 14, 2007 6:45 PM
> > To: ANTLR Interest
> > Subject: Re: [antlr-interest] Out of memory error
> > 
> > Yeah, it's building a big DFA for that decision probably.  It needs 
> > more than the usual 64M or is it even 32M default?
> > 
> > Ter
> > On Mar 14, 2007, at 3:33 PM, Mark Bednarczyk wrote:
> > 
> > > I keep getting the out of heap memory error under certain
> > conditions,
> > > and I've been trying to figure out how to specify vmargs to
> > the ANTLR3
> > > task so that I can increase the defaul 64mb to something
> > like 512mb. 
> > > Anyone know how to do that. ANTLR3 task doesn't provide any VM 
> > > options. I did verify that ANT spawns a new java VM to run
> > the subtask
> > > for org.antlr.Tool with process explorer.
> > >
> > > Buildfile: C:\jnetstream\NplLanguage\grammar.xml
> > >      [echo] pulling in property files
> > > grammar:
> > >      [echo] grammar
> > > [antlr:antlr3] ANTLR Parser Generator  Version 3.0b6 (Jan 
> 31, 2007)
> > > 1989-2007
> > > [antlr:antlr3] Exception in thread "main"  
> > > java.lang.OutOfMemoryError: Java
> > > heap space
> > > [antlr:antlr3] at java.util.Arrays.copyOf(Arrays.java:2882)
> > > [antlr:antlr3] at
> > > java.lang.AbstractStringBuilder.expandCapacity
> > > (AbstractStringBuilder.java:10
> > > 0)
> > > [antlr:antlr3] at
> > > 
> > 
> java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:390)
> > > [antlr:antlr3] at
> > java.lang.StringBuffer.append(StringBuffer.java:224)
> > > [antlr:antlr3] at java.io.StringWriter.write(StringWriter.java:84)
> > > [antlr:antlr3] at
> > > org.antlr.stringtemplate.AutoIndentWriter.indent
> > > (AutoIndentWriter.java:208)
> > > [antlr:antlr3] at
> > > org.antlr.stringtemplate.AutoIndentWriter.write
> > > (AutoIndentWriter.java:133)
> > >
> > >
> > > Here is the rule that triggers this error. If I comment out
> > the second
> > > alternative, I don't run out of memory:
> > >
> > > tableBody
> > > 	:	('{' tableConstant)
> > > 		=> ('{' tableConstants blockStatement* '}')
> > > 		-> ^(SLIST tableConstants+)
> > > 		
> > > 	|	'{' blockStatement* '}'
> > > 	;
> > >
> > > Cheers,
> > > mark...
> > >
> > >
> > 
> > 
> 
> 
> 




More information about the antlr-interest mailing list