我创建了一个新的 XText 项目,其中包含一个定义语法的 xtext 文件,并且没有更改项目中的任何其他文件。我定义的语法大约有 150 行,当尝试“生成语言基础设施”时,一切都很顺利,但后来我对其进行了扩展,现在基础设施生成失败了:
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)
我在 Eclipse 配置中检查了该操作的启动设置,并看到直到那时它是-Xmx512m
. 我试图增加这个数字,但它所做的只是现在该操作需要更多时间才能因相同的错误而崩溃。我一直到-Xmx3000m
- 不想在我的 4Gb 机器上尝试更多。
我想强调一下,我所做的只是创建一个新的 XText 项目并修改默认的“Hello X!”。语法由我自己的 200 行语法定义。我的语法编译得很好,没有警告或错误。是什么导致了这个内存错误,我该如何解决?
我找到了这篇相关的博客文章,但我承认建议的修复超出了我的水平,我不确定我需要做什么以及它是否能解决问题。