Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Java Heap Space error during code generation
Java Heap Space error during code generation [message #520544] Fri, 12 March 2010 19:08 Go to next message
Milan Milanovich is currently offline Milan MilanovichFriend
Messages: 201
Registered: July 2009
Senior Member
Hi,

my code generation from genmodel worked properly until I added some new elements to my gmfgraph/gmfmap. This is the error I'm getting:

java.lang.OutOfMemoryError: Java heap space
at org.eclipse.jdt.internal.compiler.parser.Parser.getUnspecifiedReferenceOptimized(Parser.java:8737)
at org.eclipse.jdt.internal.compiler.parser.Parser.consumePostfixExpression(Parser.java:4940)
at org.eclipse.jdt.internal.compiler.parser.Parser.consumeRule(Parser.java:5935)
at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:9339)
at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:9670)
at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.parseStatements(MethodDeclaration.java:119)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.parseMethods(TypeDeclaration.java:830)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.parse(CompilationUnitResolver.java:439)
at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:926)
at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:657)
at org.eclipse.gmf.internal.common.codegen.OrganizeImportsPostprocessor.organizeImports(OrganizeImportsPostprocessor.java:103)
at org.eclipse.gmf.internal.common.codegen.GeneratorBase.doGenerateJavaClass(GeneratorBase.java:351)
at org.eclipse.gmf.internal.common.codegen.GeneratorBase.doGenerateJavaClass(GeneratorBase.java:321)
at org.eclipse.gmf.codegen.util.Generator.generateNodeEditPart(Generator.java:384)
at org.eclipse.gmf.codegen.util.Generator.generateNode(Generator.java:294)
at org.eclipse.gmf.codegen.util.Generator.customRun(Generator.java:142)
at org.eclipse.gmf.internal.common.codegen.GeneratorBase$1.run(GeneratorBase.java:473)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1782)
at org.eclipse.gmf.internal.common.codegen.GeneratorBase.doRun(GeneratorBase.java:470)
at org.eclipse.gmf.internal.common.codegen.GeneratorBase.run(GeneratorBase.java:90)
at org.eclipse.gmf.internal.codegen.popup.actions.ExecuteTemplatesOperation.run(ExecuteTemplatesOperation.java:183)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)


sometime it is this error:

java.lang.OutOfMemoryError: Java heap space
at java.lang.AbstractStringBuilder.<init>(Unknown Source)
at java.lang.StringBuffer.<init>(Unknown Source)
at org.eclipse.jdt.internal.formatter.Scribe.printIndentationIfNecessary(Scribe.java:2328)
at org.eclipse.jdt.internal.formatter.Scribe.print(Scribe.java:1220)
at org.eclipse.jdt.internal.formatter.Scribe.printNextToken(Scribe.java:3742)
at org.eclipse.jdt.internal.formatter.CodeFormatterVisitor.visit(CodeFormatterVisitor.java:4184)
at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.traverse(MethodDeclaration.java:207)
at org.eclipse.jdt.internal.formatter.CodeFormatterVisitor.format(CodeFormatterVisitor.java:542)
at org.eclipse.jdt.internal.formatter.CodeFormatterVisitor.formatTypeMembers(CodeFormatterVisitor.java:2036)
at org.eclipse.jdt.internal.formatter.CodeFormatterVisitor.format(CodeFormatterVisitor.java:1190)
at org.eclipse.jdt.internal.formatter.CodeFormatterVisitor.visit(CodeFormatterVisitor.java:5209)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1233)
at org.eclipse.jdt.internal.formatter.CodeFormatterVisitor.visit(CodeFormatterVisitor.java:3084)
at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.traverse(CompilationUnitDeclaration.java:646)
at org.eclipse.jdt.internal.formatter.CodeFormatterVisitor.format(CodeFormatterVisitor.java:805)
at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.formatCompilationUnit(DefaultCodeFormatter.java:333)
at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.format(DefaultCodeFormatter.java:205)
at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.format(DefaultCodeFormatter.java:188)
at org.eclipse.gmf.internal.common.codegen.GeneratorBase.formatCode(GeneratorBase.java:453)
at org.eclipse.gmf.internal.common.codegen.GeneratorBase.doGenerateJavaClass(GeneratorBase.java:357)
at org.eclipse.gmf.internal.common.codegen.GeneratorBase.doGenerateJavaClass(GeneratorBase.java:321)
at org.eclipse.gmf.codegen.util.Generator.generateLinkLabelEditPart(Generator.java:408)
at org.eclipse.gmf.codegen.util.Generator.customRun(Generator.java:170)
at org.eclipse.gmf.internal.common.codegen.GeneratorBase$1.run(GeneratorBase.java:473)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1782)
at org.eclipse.gmf.internal.common.codegen.GeneratorBase.doRun(GeneratorBase.java:470)
at org.eclipse.gmf.internal.common.codegen.GeneratorBase.run(GeneratorBase.java:90)
at org.eclipse.gmf.internal.codegen.popup.actions.ExecuteTemplatesOperation.run(ExecuteTemplatesOperation.java:183)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)



I'm using WinXP SP3 + JDK 1.6 + Eclipse Modeling Galileo SR1. I'm starting Eclipse with these args:
E:\eclipse\eclipse.exe -vmargs -Xms512m -Xmx512m -XX:PermSize=256m -XX:MaxPermSize=512m -XX:NewRatio=16.
As I have 2Gb of RAM, I tried to set -Xmx1024m, but Eclipse won't start. What can I do?

--
Thanks in advance, Milan

[Updated on: Fri, 12 March 2010 19:11]

Report message to a moderator

Re: Java Heap Space error during code generation [message #520628 is a reply to message #520544] Sat, 13 March 2010 13:38 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31834
Registered: July 2009
Senior Member
Milan,

Your permsize is probably much bigger than it needs to be. You might
try increasing the heap size to something less that 1G.


Milan wrote:
> Hi,
>
> my code generation from genmodel worked properly until I add ed some
> new elements to my gmfgraph/gmfmap. This is the error I get:
>
> java.lang.OutOfMemoryError: Java heap space
> at
> org.eclipse.jdt.internal.compiler.parser.Parser.getUnspecifi edReferenceOptimized(Parser.java:8737)
>
> at
> org.eclipse.jdt.internal.compiler.parser.Parser.consumePostf ixExpression(Parser.java:4940)
>
> at
> org.eclipse.jdt.internal.compiler.parser.Parser.consumeRule( Parser.java:5935)
>
> at
> org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser .java:9339)
> at
> org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser .java:9670)
> at
> org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.pars eStatements(MethodDeclaration.java:119)
>
> at
> org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.parseM ethods(TypeDeclaration.java:830)
>
> at
> org.eclipse.jdt.core.dom.CompilationUnitResolver.parse(Compi lationUnitResolver.java:439)
>
> at
> org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTPars er.java:926)
> at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java: 657)
> at
> org.eclipse.gmf.internal.common.codegen.OrganizeImportsPostp rocessor.organizeImports(OrganizeImportsPostprocessor.java:1 03)
>
> at
> org.eclipse.gmf.internal.common.codegen.GeneratorBase.doGene rateJavaClass(GeneratorBase.java:351)
>
> at
> org.eclipse.gmf.internal.common.codegen.GeneratorBase.doGene rateJavaClass(GeneratorBase.java:321)
>
> at
> org.eclipse.gmf.codegen.util.Generator.generateNodeEditPart( Generator.java:384)
>
> at
> org.eclipse.gmf.codegen.util.Generator.generateNode(Generato r.java:294)
> at org.eclipse.gmf.codegen.util.Generator.customRun(Generator.j ava:142)
> at
> org.eclipse.gmf.internal.common.codegen.GeneratorBase$1.run( GeneratorBase.java:473)
>
> at org.eclipse.core.internal.resources.Workspace.run(Workspace. java:1800)
> at org.eclipse.core.internal.resources.Workspace.run(Workspace. java:1782)
> at
> org.eclipse.gmf.internal.common.codegen.GeneratorBase.doRun( GeneratorBase.java:470)
>
> at
> org.eclipse.gmf.internal.common.codegen.GeneratorBase.run(Ge neratorBase.java:90)
>
> at
> org.eclipse.gmf.internal.codegen.popup.actions.ExecuteTempla tesOperation.run(ExecuteTemplatesOperation.java:183)
>
> at
> org.eclipse.jface.operation.ModalContext$ModalContextThread. run(ModalContext.java:121)
>
>
> I'm using WinXP + JDK 1.6 + Eclipse Modeling Galileo SR1. I'm starting
> Eclipse with these args:
> E:\eclipse\eclipse.exe -vmargs -Xms512m -Xmx512m -XX:PermSize=256m
> -XX:MaxPermSize=512m -XX:NewRatio=16.
> As I have 2Gb of RAM, I tried to set -Xmx1024m, but Eclipse won't
> start. What can I do?
>
> --
> Thanks in advance, Milan


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Java Heap Space error during code generation [message #521187 is a reply to message #520544] Tue, 16 March 2010 16:57 Go to previous messageGo to next message
Milan Milanovich is currently offline Milan MilanovichFriend
Messages: 201
Registered: July 2009
Senior Member
Dear Ed,

O.K. Thanks. I set Xmx to 766m and MaxPermSize to 256m and it works now.

However, now in the generated method getViewChildren() of MyEditorNavigatorContentProvider I get this error:

The code of method getViewChildren(View, Object) is exceeding the 65535 bytes limit	MyEditorNavigatorContentProvider.java	...


It seems that the method is too large after generation. What could I do in this case, as this is the method that should be generated often?

--
thanks, Milan

Re: Java Heap Space error during code generation [message #521193 is a reply to message #521187] Tue, 16 March 2010 17:09 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 31834
Registered: July 2009
Senior Member
Milan,

That's just a hard Java limit. There's not much you can do other than
split the method up. It must be a very very large model...


Milan wrote:
> Dear Ed,
>
> O.K. Thanks. I set Xmx to 766m and MaxPermSize to 256m and it works now.
>
> However, now in the generated method getViewChildren() of
> MyEditorNavigatorContentProvider I get this error:
>
> The code of method getViewChildren(View, Object) is exceeding the
> 65535 bytes limit MyEditorNavigatorContentProvider.java ...
>
> It seems that the method is too large after generation. What could I
> do in this case, as this is the method that should be generated often?
>
> --
> thanks, Milan
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:gmf
Next Topic:Capture linestyle of a connection and change it
Goto Forum:
  


Current Time: Thu Apr 15 12:12:01 GMT 2021

Powered by FUDForum. Page generated in 0.01976 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top