I've created a new XText project with a single xtext file defining the grammar, and without changing any other files in the project. The grammar I defined took about 150 lines and when trying to "generate language infrastructure" everything went smoothly, but then I expanded it a bit and now that infrastructure generation fails on:
460476 [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher - Java heap space
java.lang.OutOfMemoryError: Java heap space
at java.util.ArrayList.iterator(Unknown Source)
at org.eclipse.xtext.util.formallang.PdaUtil$TraversalItem.<init>(PdaUtil.java:247)
at org.eclipse.xtext.util.formallang.PdaUtil.newItem(PdaUtil.java:531)
at org.eclipse.xtext.util.formallang.PdaUtil.filterEdges(PdaUtil.java:451)
at org.eclipse.xtext.serializer.analysis.ContextTypePDAProvider.createPDA(ContextTypePDAProvider.java:178)
at org.eclipse.xtext.serializer.analysis.ContextTypePDAProvider.getContextTypePDA(ContextTypePDAProvider.java:188)
at org.eclipse.xtext.serializer.analysis.SyntacticSequencerPDAProvider.getPDA(SyntacticSequencerPDAProvider.java:604)
at org.eclipse.xtext.generator.serializer.SyntacticSequencerUtil.getAllPDAs(SyntacticSequencerUtil.java:59)
at org.eclipse.xtext.generator.serializer.SyntacticSequencerUtil.getAllAmbiguousTransitions(SyntacticSequencerUtil.java:79)
at org.eclipse.xtext.generator.serializer.SyntacticSequencerUtil.getAllAmbiguousTransitionsBySyntax(SyntacticSequencerUtil.java:90)
at org.eclipse.xtext.generator.serializer.AbstractSyntacticSequencer.getFileContents(AbstractSyntacticSequencer.java:95)
at org.eclipse.xtext.generator.serializer.SerializerFragment.generate(SerializerFragment.java:97)
at org.eclipse.xtext.generator.Xtend2GeneratorFragment.generate(Xtend2GeneratorFragment.java:66)
at org.eclipse.xtext.generator.Xtend2GeneratorFragment.generate(Xtend2GeneratorFragment.java:59)
at org.eclipse.xtext.generator.CompositeGeneratorFragment.generate(CompositeGeneratorFragment.java:92)
at org.eclipse.xtext.generator.LanguageConfig.generate(LanguageConfig.java:113)
at org.eclipse.xtext.generator.Generator.generate(Generator.java:361)
at org.eclipse.xtext.generator.Generator.invokeInternal(Generator.java:128)
at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:126)
at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.invoke(Mwe2Bridge.java:34)
at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:201)
at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.invoke(AbstractCompositeWorkflowComponent.java:35)
at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:19)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:102)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:62)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:74)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:35)
I checked my launch settings in the Eclipse configuration for that action and saw that until that time it was -Xmx512m
. I tried to increase that number and all it did was that now the action takes more time before crashing on the same error. I got all the way up to -Xmx3000m
- didn't want to try more on my 4Gb machine.
I want to stress that all I did was create a new XText project and modify the default "Hello X!" grammar to by a 200-line grammar definition of my own. My grammar compiles just fine, giving no warnings or errors. What caused this memory error to be introduced, and how can I fix it?
I've found this related blog post but I admit the proposed fixes there are beyond my level, I'm not sure what precisely I need to do and whether it will fix the problem at all.
common.Terminals
. – Oak