Editor crash: 'java heap space'

So, I’ve been getting these weird errors as of late… It’s the editor crashing; doesn’t matter what I’m trying to open. Restarting Defold solves it for like 10 minutes…

Here’s the error log:

eclipse.buildId=unknown
java.version=1.8.0_05
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=sv_SE
Command-line arguments: -os win32 -ws win32 -arch x86

Error
Mon Apr 20 09:51:00 CEST 2015
Unable to create editor ID com.dynamo.cr.go.editors.CollectionEditor: Java heap space

org.eclipse.ui.PartInitException: Java heap space
at com.dynamo.cr.sceneed.ui.SceneEditor.init(SceneEditor.java:233)
at org.eclipse.ui.internal.EditorManager.createSite(EditorManager.java:828)
at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:647)
at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:465)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:315)
at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:180)
at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:270)
at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65)
at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:473)
at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1245)
at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1198)
at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1597)
at org.eclipse.ui.internal.PartStack.add(PartStack.java:493)
at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:103)
at org.eclipse.ui.internal.PartStack.add(PartStack.java:479)
at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:112)
at org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:63)
at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:225)
at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:213)
at org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:808)
at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:707)
at org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:666)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2955)
at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2863)
at org.eclipse.ui.internal.WorkbenchPage.access$11(WorkbenchPage.java:2855)
at org.eclipse.ui.internal.WorkbenchPage$10.run(WorkbenchPage.java:2806)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2802)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2786)
at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2777)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:655)
at org.eclipse.ui.ide.IDE.openEditor(IDE.java:614)
at org.eclipse.ui.actions.OpenFileAction.openFile(OpenFileAction.java:99)
at org.eclipse.ui.actions.OpenSystemEditorAction.run(OpenSystemEditorAction.java:99)
at org.eclipse.ui.actions.RetargetAction.run(RetargetAction.java:221)
at org.eclipse.ui.navigator.CommonNavigatorManager$3.open(CommonNavigatorManager.java:185)
at org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48)
at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:866)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:864)
at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1152)
at org.eclipse.ui.navigator.CommonViewer.handleOpen(CommonViewer.java:462)
at org.eclipse.jface.viewers.StructuredViewer$6.handleOpen(StructuredViewer.java:1256)
at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:275)
at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:269)
at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:309)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at com.dynamo.cr.editor.Application.start(Application.java:42)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
Caused by: java.lang.OutOfMemoryError: Java heap space
at java.awt.image.DataBufferByte.(Unknown Source)
at java.awt.image.Raster.createInterleavedRaster(Unknown Source)
at java.awt.image.BufferedImage.(Unknown Source)
at com.dynamo.bob.textureset.TextureSetGenerator.composite(TextureSetGenerator.java:238)
at com.dynamo.bob.textureset.TextureSetGenerator.generate(TextureSetGenerator.java:153)
at com.dynamo.bob.tile.TileSetGenerator.generate(TileSetGenerator.java:104)
at com.dynamo.cr.tileeditor.scene.TileSetNode.updateVertexData(TileSetNode.java:330)
at com.dynamo.cr.tileeditor.scene.TileSetNode.updateData(TileSetNode.java:416)
at com.dynamo.cr.tileeditor.scene.TileSetNode.setModel(TileSetNode.java:351)
at com.dynamo.cr.tileeditor.scene.SpriteNode.reloadTileSource(SpriteNode.java:193)
at com.dynamo.cr.tileeditor.scene.SpriteNode.setModel(SpriteNode.java:161)
at com.dynamo.cr.sceneed.core.Node.setModel(Node.java:416)
at com.dynamo.cr.sceneed.core.Node.setModel(Node.java:416)
at com.dynamo.cr.go.core.RefGameObjectInstanceNode.setModel(RefGameObjectInstanceNode.java:52)
at com.dynamo.cr.sceneed.core.Node.setModel(Node.java:416)
at com.dynamo.cr.sceneed.core.SceneModel.setRoot(SceneModel.java:151)
at com.dynamo.cr.sceneed.core.ScenePresenter.onLoad(ScenePresenter.java:76)
at com.dynamo.cr.sceneed.ui.SceneLoader.run(SceneLoader.java:25)
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:507)
at org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.run(ProgressMonitorJobsDialog.java:275)
at org.eclipse.ui.internal.progress.ProgressManager.run(ProgressManager.java:1162)
at org.eclipse.ui.internal.progress.ProgressManager$RunnableWithStatus.run(ProgressManager.java:1346)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.progress.ProgressManager$7.run(ProgressManager.java:1184)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180)
at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:4687)
at org.eclipse.ui.internal.progress.ProgressManager.runInUI(ProgressManager.java:1182)
at com.dynamo.cr.sceneed.ui.SceneEditor.init(SceneEditor.java:231)
at org.eclipse.ui.internal.EditorManager.createSite(EditorManager.java:828)

Ok, restarting Defold didn’t work this time. :confused:
The only things I can open are scripts (I guess that’s another editor)

Ok. Perhaps it’s content that uses the memory in question. Could you try to increase the heap allocated by java?

  1. Locate the file “Defold.ini” in the defold directory
  2. Change the line:
    -Xmx1200M
    to
    -Xmx2000M
  3. Save the file and restart Defold.

If that does the trick, it was just normal usage and we might consider increasing the default values in the dist. Please let me know if it works (will try to provoke it myself as well in the meantime)

That did it! Thanks! :smile:

1 Like

Ran into the same problem now and changing 1200M to 2000M did the trick.
How high can I set this number to? Still get the error if I open many collections at once

Regarding how high this number can be:

The Windows editor is still 32-bit which means that the limit is in the area of 3000M, give or take 500M (guessing here). Some of the 4 GB process memory space needs to be left to native code+memory, thread stacks, etc.

On OSX it’s already 64-bit and the limit is more or less the amount of RAM on your local machine. I wouldn’t recommend going above 8000M without keeping an eye on exactly how memory is exercised (freed/allocated).

Also, as you say, another solution is not to have so many collection tabs open at the same time.