Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Out of memory
[Acceleo] Out of memory [message #1700360] Thu, 02 July 2015 07:27 Go to next message
Wilbert Alberts is currently offline Wilbert AlbertsFriend
Messages: 169
Registered: June 2010
Senior Member
Hi,

I'm working on a project that uses Acceleo for generating C++ code.

Unfortunately I'm experiencing out of memory errors. As I expected some errors in my templates or queries I started to comment out parts of my templates.

Somewhere I got to the point that this version was working:
[template public generateDto(e : Entity, r: EntityRecipe, im: ImplementationModel)]
[comment e.generateDTOInterfaceHeader(r, im)/]
[comment e.generateDTOAdapterHeader(r, im)/]
[e.generateDTOAdapterImplementation(r, im)/]
[/template]


Removing the first comment lead to the OOM error. So I started pruning the generateDTOInterfaceHeader template itself. However, up to the point that it was completely empty, I stil ran into OOM errors. So even this didn't work:

[template public generateDto(e : Entity, r: EntityRecipe, im: ImplementationModel)]
[e.generateDTOInterfaceHeader(r, im)/]
[comment e.generateDTOAdapterHeader(r, im)/]
[e.generateDTOAdapterImplementation(r, im)/]
[/template]

[template private generateDTOInterfaceHeader(e : Entity, r: EntityRecipe, im: ImplementationModel)]
[/template]


I'm wondering how invocation of an empty template increases memory.

In order to give some additional information, I'm using the luna eclipse release with Acceleo: 3.5.1.201409021433.

The stack strace reporting the OOM:
!ENTRY com.asml.innovationteam.DCA.generator.ui 4 0 2015-07-02 09:26:29.218
!MESSAGE 
!STACK 0
java.lang.reflect.InvocationTargetException
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:423)
	at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:527)
	at org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.run(ProgressMonitorJobsDialog.java:284)
	at org.eclipse.ui.internal.progress.ProgressManager$3.run(ProgressManager.java:983)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:1018)
	at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:993)
	at org.eclipse.ui.internal.progress.ProgressManager.run(ProgressManager.java:1194)
	at com.asml.innovationteam.DCA.generator.ui.popupMenus.AcceleoGenerateGeneratorAction.run(AcceleoGenerateGeneratorAction.java:93)
	at org.eclipse.ui.actions.ActionDelegate.runWithEvent(ActionDelegate.java:75)
	at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:243)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:595)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:511)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:420)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4172)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Caused by: java.lang.OutOfMemoryError: Java heap space
	at java.util.Arrays.copyOf(Arrays.java:2367)
	at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:130)
	at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:114)
	at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:480)
	at java.lang.StringBuffer.append(StringBuffer.java:309)
	at java.util.regex.Matcher.appendReplacement(Matcher.java:838)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.fitIndentationTo(AcceleoEvaluationVisitor.java:310)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.delegateFitIndentation(AcceleoEvaluationVisitor.java:1446)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoTemplateInvocation(AcceleoEvaluationVisitor.java:1015)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1881)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1065)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoForBlock(AcceleoEvaluationVisitor.java:530)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1858)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1065)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoForBlock(AcceleoEvaluationVisitor.java:530)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1858)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1065)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoTemplate(AcceleoEvaluationVisitor.java:937)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1842)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1065)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoTemplateInvocation(AcceleoEvaluationVisitor.java:988)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1881)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1065)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoTemplate(AcceleoEvaluationVisitor.java:937)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1842)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1065)
	at org.eclipse.ocl.internal.evaluation.QueryImpl.evaluate(QueryImpl.java:146)
	at org.eclipse.ocl.ecore.QueryImpl.evaluate(QueryImpl.java:56)
	at org.eclipse.acceleo.engine.generation.AcceleoEngine.doEvaluate(AcceleoEngine.java:365)
	at org.eclipse.acceleo.engine.generation.AcceleoEngine.evaluate(AcceleoEngine.java:142)
	at org.eclipse.acceleo.engine.service.AcceleoService.doGenerateTemplate(AcceleoService.java:984)
	at org.eclipse.acceleo.engine.service.AcceleoService.doGenerate(AcceleoService.java:641)
Root exception:
java.lang.OutOfMemoryError: Java heap space
	at java.util.Arrays.copyOf(Arrays.java:2367)
	at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:130)
	at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:114)
	at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:480)
	at java.lang.StringBuffer.append(StringBuffer.java:309)
	at java.util.regex.Matcher.appendReplacement(Matcher.java:838)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.fitIndentationTo(AcceleoEvaluationVisitor.java:310)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.delegateFitIndentation(AcceleoEvaluationVisitor.java:1446)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoTemplateInvocation(AcceleoEvaluationVisitor.java:1015)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1881)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1065)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoForBlock(AcceleoEvaluationVisitor.java:530)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1858)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1065)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoForBlock(AcceleoEvaluationVisitor.java:530)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1858)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1065)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoTemplate(AcceleoEvaluationVisitor.java:937)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1842)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1065)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoTemplateInvocation(AcceleoEvaluationVisitor.java:988)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1881)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1065)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoTemplate(AcceleoEvaluationVisitor.java:937)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1842)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1065)
	at org.eclipse.ocl.internal.evaluation.QueryImpl.evaluate(QueryImpl.java:146)
	at org.eclipse.ocl.ecore.QueryImpl.evaluate(QueryImpl.java:56)
	at org.eclipse.acceleo.engine.generation.AcceleoEngine.doEvaluate(AcceleoEngine.java:365)
	at org.eclipse.acceleo.engine.generation.AcceleoEngine.evaluate(AcceleoEngine.java:142)
	at org.eclipse.acceleo.engine.service.AcceleoService.doGenerateTemplate(AcceleoService.java:984)
	at org.eclipse.acceleo.engine.service.AcceleoService.doGenerate(AcceleoService.java:641)


Any ideas?

Greetings,
Wilbert.
Re: [Acceleo] Out of memory [message #1700365 is a reply to message #1700360] Thu, 02 July 2015 07:51 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
Did you try increasing the maximum heap size in Eclipse.ini?, i.e.,
-Xmx2048m

Best,

Víctor

El 02/07/2015 a las 9:27, Wilbert Alberts escribió:
> Hi,
>
> I'm working on a project that uses Acceleo for generating C++ code.
>
> Unfortunately I'm experiencing out of memory errors. As I expected some
> errors in my templates or queries I started to comment out parts of my
> templates.
>
> Somewhere I got to the point that this version was working:
>
> [template public generateDto(e : Entity, r: EntityRecipe, im:
> ImplementationModel)]
> [comment e.generateDTOInterfaceHeader(r, im)/]
> [comment e.generateDTOAdapterHeader(r, im)/]
> [e.generateDTOAdapterImplementation(r, im)/]
> [/template]
>
> Removing the first comment lead to the OOM error. So I started pruning
> the generateDTOInterfaceHeader template itself. However, up to the point
> that it was completely empty, I stil ran into OOM errors. So even this
> didn't work:
>
> [template public generateDto(e : Entity, r: EntityRecipe, im:
> ImplementationModel)]
> [e.generateDTOInterfaceHeader(r, im)/]
> [comment e.generateDTOAdapterHeader(r, im)/]
> [e.generateDTOAdapterImplementation(r, im)/]
> [/template]
>
> [template private generateDTOInterfaceHeader(e : Entity, r:
> EntityRecipe, im: ImplementationModel)]
> [/template]
>
> I'm wondering how invocation of an empty template increases memory.
> In order to give some additional information, I'm using the luna eclipse
> release with Acceleo: 3.5.1.201409021433.
> The stack strace reporting the OOM:
> !ENTRY com.asml.innovationteam.DCA.generator.ui 4 0 2015-07-02 09:26:29.218
> !MESSAGE !STACK 0
> java.lang.reflect.InvocationTargetException
> at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:423)
> at
> org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:527)
>
> at
> org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.run(ProgressMonitorJobsDialog.java:284)
>
> at
> org.eclipse.ui.internal.progress.ProgressManager$3.run(ProgressManager.java:983)
>
> at
> org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
> at
> org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:1018)
>
> at
> org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:993)
>
> at
> org.eclipse.ui.internal.progress.ProgressManager.run(ProgressManager.java:1194)
>
> at
> com.asml.innovationteam.DCA.generator.ui.popupMenus.AcceleoGenerateGeneratorAction.run(AcceleoGenerateGeneratorAction.java:93)
>
> at
> org.eclipse.ui.actions.ActionDelegate.runWithEvent(ActionDelegate.java:75)
> at
> org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:243)
> at
> org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:595)
>
> at
> org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:511)
>
> at
> org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:420)
>
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
> at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
> at
> org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4172)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
>
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
>
> at
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
>
> at
> org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
>
> at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
> at
> org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
> at
> org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
>
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>
> at java.lang.reflect.Method.invoke(Method.java:601)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
> Caused by: java.lang.OutOfMemoryError: Java heap space
> at java.util.Arrays.copyOf(Arrays.java:2367)
> at
> java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:130)
>
> at
> java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:114)
>
> at
> java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:480)
> at java.lang.StringBuffer.append(StringBuffer.java:309)
> at java.util.regex.Matcher.appendReplacement(Matcher.java:838)
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.fitIndentationTo(AcceleoEvaluationVisitor.java:310)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.delegateFitIndentation(AcceleoEvaluationVisitor.java:1446)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoTemplateInvocation(AcceleoEvaluationVisitor.java:1015)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1881)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1065)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoForBlock(AcceleoEvaluationVisitor.java:530)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1858)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1065)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoForBlock(AcceleoEvaluationVisitor.java:530)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1858)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1065)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoTemplate(AcceleoEvaluationVisitor.java:937)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1842)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1065)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoTemplateInvocation(AcceleoEvaluationVisitor.java:988)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1881)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1065)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoTemplate(AcceleoEvaluationVisitor.java:937)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1842)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1065)
>
> at
> org.eclipse.ocl.internal.evaluation.QueryImpl.evaluate(QueryImpl.java:146)
> at org.eclipse.ocl.ecore.QueryImpl.evaluate(QueryImpl.java:56)
> at
> org.eclipse.acceleo.engine.generation.AcceleoEngine.doEvaluate(AcceleoEngine.java:365)
>
> at
> org.eclipse.acceleo.engine.generation.AcceleoEngine.evaluate(AcceleoEngine.java:142)
>
> at
> org.eclipse.acceleo.engine.service.AcceleoService.doGenerateTemplate(AcceleoService.java:984)
>
> at
> org.eclipse.acceleo.engine.service.AcceleoService.doGenerate(AcceleoService.java:641)
>
> Root exception:
> java.lang.OutOfMemoryError: Java heap space
> at java.util.Arrays.copyOf(Arrays.java:2367)
> at
> java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:130)
>
> at
> java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:114)
>
> at
> java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:480)
> at java.lang.StringBuffer.append(StringBuffer.java:309)
> at java.util.regex.Matcher.appendReplacement(Matcher.java:838)
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.fitIndentationTo(AcceleoEvaluationVisitor.java:310)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.delegateFitIndentation(AcceleoEvaluationVisitor.java:1446)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoTemplateInvocation(AcceleoEvaluationVisitor.java:1015)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1881)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1065)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoForBlock(AcceleoEvaluationVisitor.java:530)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1858)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1065)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoForBlock(AcceleoEvaluationVisitor.java:530)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1858)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1065)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoTemplate(AcceleoEvaluationVisitor.java:937)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1842)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1065)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoTemplateInvocation(AcceleoEvaluationVisitor.java:988)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1881)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1065)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoTemplate(AcceleoEvaluationVisitor.java:937)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1842)
>
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1065)
>
> at
> org.eclipse.ocl.internal.evaluation.QueryImpl.evaluate(QueryImpl.java:146)
> at org.eclipse.ocl.ecore.QueryImpl.evaluate(QueryImpl.java:56)
> at
> org.eclipse.acceleo.engine.generation.AcceleoEngine.doEvaluate(AcceleoEngine.java:365)
>
> at
> org.eclipse.acceleo.engine.generation.AcceleoEngine.evaluate(AcceleoEngine.java:142)
>
> at
> org.eclipse.acceleo.engine.service.AcceleoService.doGenerateTemplate(AcceleoService.java:984)
>
> at
> org.eclipse.acceleo.engine.service.AcceleoService.doGenerate(AcceleoService.java:641)
>
>
>
> Any ideas?
>
> Greetings,
> Wilbert.
>
Re: [Acceleo] Out of memory [message #1700367 is a reply to message #1700365] Thu, 02 July 2015 08:04 Go to previous messageGo to next message
Wilbert Alberts is currently offline Wilbert AlbertsFriend
Messages: 169
Registered: June 2010
Senior Member
Hi,

Yes, I did increase the memory by -Xmx6g.

That helps, but is not sufficient. I want to find the cause of the problem, not to fight the symptoms.

I simply don't understand why the invocation of an empty template leads to more memory consumption. As far as I can understand it either indicates a memory leak in the Acceleo engine or some kind of error in my templates.

Greetings,
Wilbert.
Re: [Acceleo] Out of memory [message #1700374 is a reply to message #1700367] Thu, 02 July 2015 08:48 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5513
Registered: July 2009
Senior Member
Hi

A guess...

Acceleo is required to ensure that each template/query is invoked just
once so that a previous invocation is re-used.

Acceleo has problems with templates/queries involving just
PrimitiveTypes because there seems to be insufficient information to
derive a unique identity from.

It might well be the case that an empty template also lacks unique
identity and so it is being repeatedly created for all possible objects.

Regards

Ed Willink


On 02/07/2015 09:04, Wilbert Alberts wrote:
> Hi,
>
> Yes, I did increase the memory by -Xmx6g.
> That helps, but is not sufficient. I want to find the cause of the
> problem, not to fight the symptoms.
>
> I simply don't understand why the invocation of an empty template
> leads to more memory consumption. As far as I can understand it either
> indicates a memory leak in the Acceleo engine or some kind of error in
> my templates.
> Greetings,
> Wilbert.
>
Re: [Acceleo] Out of memory [message #1700380 is a reply to message #1700374] Thu, 02 July 2015 09:30 Go to previous messageGo to next message
Wilbert Alberts is currently offline Wilbert AlbertsFriend
Messages: 169
Registered: June 2010
Senior Member
Hi,

I used -XX:+HeapDumpOnOutOfMemoryError to get the heap on my out of memory error. Using the memory analysis facilities in eclipse I found out that my largest object on the heap is a character array of approx 456,000,000 bytes.

I managed to save the char[] to a file and started inspecting its content. It turns out that it is a combination of spaces, tabs and newlines.

Given the fact that the stack trace contains invocations of at ..AcceleoEvaluationVisitor.fitIndentationTo
and ...AcceleoEvaluationVisitor.delegateFitIndentation I'm getting suspicious.

Maybe some of the Acceleo developers can tell me why such big array needs to be maintained (and if so, if there are things I can change in my templates to prevent this one from getting so big).

Greetings,
Wilbert.

Re: [Acceleo] Out of memory [message #1700401 is a reply to message #1700380] Thu, 02 July 2015 11:55 Go to previous message
Wilbert Alberts is currently offline Wilbert AlbertsFriend
Messages: 169
Registered: June 2010
Senior Member
Hi,

I put a breakpoint on the OutOfMemory exception and ran the generator again. Then I found out that it was the result of the template invocation that got that big. Please take a look at the following snippet:
	[for (aRecipe : EntityRecipe | anImpModel.recipe->filter(EntityRecipe))]
		[for (anEntity : Entity | aRecipe.entity)]
Dit voorkomt een bug.
            [anEntity.generateRepo(anImpModel, aRecipe)/]
            [anEntity.generateDto(aRecipe, anImpModel)/]
			[anEntity.generateEntityDTOFactory(aRecipe, anImpModel)/]
		[/for]
	[/for]

The exception triggered during the execution of generateRepo. Note that up to this moment (in the generator execution) no file is open. (So the [file] statement is found at a deeper level. For some reason, the result of the generateRepo invocation turned out to consist of only spaces, tabs and newlines. At the end of a template invocation, Acceleo tries to apply the indentation. During this process, a very large string is produced. It is based on some regular expression matching.

By adding 'Dit voorkomt een bug', the regular expression matching seems to work better, or seems not to create such a large string. Anyhow, the bug gets prevented/worked around.

Obeo: do I need to file a bug report for this one?

Greetings,
Wilbert.
Previous Topic:Android Code Generation
Next Topic:[Acceleo] Run my generator code from CLI
Goto Forum:
  


Current Time: Mon Dec 11 09:42:22 GMT 2017

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

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