java.lang.OutOfMemoryError: Java heap space in Editor 2

When building on Editor 2 I get the java.lang.OutOfMemoryError: Java heap space (on OSX). For the old editor there is an ini-file where you could set the limit (as per this answer), but how do you increase the heap space for the new editor?

1 Like

Good question! @Ragnar_Svensson, @Erik_Angelin, @Ragnar_Dahlen, @mats.gisselson?

There is a “config” file in the Defold.app under Contents/Resources. Try adding -Xmx2048m or whatever you want there?

We have seen a lot of these errors and have been hunting them down for a while. Obviously it should work without any local tweaks in the config file (it will unfortunately also be overwritten when you upgrade version). Do you mind adding me to your project so I can check next week?

1 Like

@Pkeod Thank you! I’ll see what I can work out.

@Ragnar_Svensson You have been added.

My config look like this,

[bootstrap]
resourcespath = 

[build]
version = 1.2.108
sha1 = 6a36f46bbd1180851909b2f15171d22b502dd38e
time = 2017-07-08T00:43:25.979550

[launcher]
jre = ${bootstrap.resourcespath}/packages/jre
java = ${launcher.jre}/bin/java
jar = ${bootstrap.resourcespath}/packages/defold-${build.sha1}.jar
main = com.defold.editor.Start
debug = 1
updateurl = https://d.defold.com/editor2
vmargs = -Djna.nosys=true,-Ddefold.resourcespath=${bootstrap.resourcespath},-Ddefold.version=${build.version},-Ddefold.sha1=${build.sha1},-Ddefold.buildtime=${build.time},-Djava.ext.dirs=${launcher.jre}/lib/ext,-Djava.net.preferIPv4Stack=true,-Dsun.net.client.defaultConnectTimeout=30000,-Dsun.net.client.defaultReadTimeout=30000,-Djogl.texture.notexrect=true,-Ddefold.update.url=${launcher.updateurl},-Dglass.accessible.force=false

[platform]
osx = -Xdock:icon=${bootstrap.resourcespath}/logo.icns,-Xdock:name=Defold
windows = 
linux = 

Where exactly i put -Xmx2048m ?

I think you need to add it to the comma separated list of vmargs.

vmargs = -Xmx2048m,  -Djna.nosys=true,-Ddefold.launcherpath=${bootstrap.launcherpath},-Ddefold.resourcespath=${bootstrap.resourcespath},-Ddefold.version=${build.version},-Ddefold.editor.sha1=${build.editor_sha1},-Ddefold.engine.sha1=${build.engine_sha1},-Ddefold.buildtime=${build.time},-Ddefold.channel=${build.channel},-Djava.ext.dirs=${launcher.jre}/lib/ext,-Djava.net.preferIPv4Stack=true,-Dsun.net.client.defaultConnectTimeout=30000,-Dsun.net.client.defaultReadTimeout=30000,-Djogl.texture.notexrect=true,-Dglass.accessible.force=false

after i added -Xmx2048m my defold can`t run. how i need to do for fix this? please

Remove spaces between the two args and try again. Like this:

vmargs = -Xmx2048m,-Djna.nosys=true,...

@Erik_Angelin and @mats.gisselson, have the instructions changed or is the above still correct?

2 Likes

Did you have problems starting the editor at all? Or only with a particular project? In general you shouldn’t have to fiddle with these settings. If you run out of memory, we’ve either messed up or you have a truly huge project.

2 Likes

thanks you! it runed. i have window 7 with 3gb dram, correct is “-Xmx1024m”.

1 Like