Java heap size error

Hello, everyone
My project has a lot of sprites and atlases, and after another atlas adding, editor stoped being able to run, and every time sending me this error:


I’v found on the forum some similar issues, and the cure was something like this:

But the problem is that i don’t have ini file on my mac:

So, I need your help…

The file you need to edit is called config now. Is it in the Resources folder?

The .app looks to be codesigned on macOS which would give you problems if you modified the files inside…

Maybe there is another way to increase heap size of the editor on macOS.

1 Like

Correct. You should be able to increase the value by editing Defold.app/Contents/Resource/config.

But I’d also like to ask how many atlases you have and how big they are?

1 Like

I have 23 atlases 10-15 sprites each

Which value should I increase? There is no Xmx…

Add ,-Xmx6g at the end of the command line. This should give you 6GB of heap space, which is hopefully enough.

I have a similarily large project (Interrogation) and when I was actively working on it I would have this in my ~/.zshrc (if you use Bash, put it in ~/.bashrc) to help and I would run it after every Defold update:

patch-defold-heap() {
  sed -i "" -e 's/,-Xmx6g//' -e 's/vmargs = \(.*\)$/vmargs = \1,-Xmx6g/' /Applications/Defold.app/Contents/Resources/config
}

(Also I needed this only on my laptop which has 8GB of RAM. Java calculates the default max heap size based on the system’s installed memory and on my laptop that would be lower than on my 16GB desktop)

2 Likes

Excuse me for my stupidity, but can u explain me again like for 5th grader where and what should i add…:upside_down_face:

In Defold.app/Contents/Resources/config, here (where the selection is):

Also make sure you open Defold at least once after each update before editing that file so that it gets whitelisted by Gatekeeper (macOS code signing stuff).

1 Like

Got it. Thanks a lot!

1 Like