0

I originally posted this on stackoverflow, but they sent me here, so apologies for the copy-paste.

When I'm running the arduino IDE, it crashes, saying that "java could not create a virtual machine". When I run the debug app it says "Invalid maximum heap size: -Xmx5G". From what I found online, this is because the Arduino IDE uses 32bit java. I have not found a solution online. I also would like to not change the heap size in _JAVA_OPTIONS if possible.

2
  • 1
    Why do you need to use such a large heap and why can you not simply install a 64-bit version of Java?
    – Mokubai
    Commented Dec 2, 2019 at 13:29
  • 1
    The largest heap supported by the 32-bit Java VM is 4 GB. Since it's non-default behavior to specify the heap size, and unsupported behavior to set it to that size on a 32-bit Java VM, you should modify your configuration appropriately. However, I cannot think of a single reason, that Arduino IDE could not use the 64-bit Java VM instead.
    – Ramhound
    Commented Dec 2, 2019 at 15:39

1 Answer 1

1

If you are setting this for the entire system per your comment

I do not need 5GB for the Arduino IDE. The setting is in the _JAVA_OPTIONS environment variable. I need 5GB for something else.

You have 2 options.

  1. Remove that environment variable and create a batch file that launches "something else" with the environment variable set.
  2. Create a batch file that launches the Arduino IDE after clearing that environment variable.
    For example

    Set _JAVA_OPTIONS=
    YourArduinoIDE.exe
    

    Will clear the variable and run the program.

Option 1 would be best and more compatible. The applications that need that set by default should be doing that as part of their startup. Over-allocating heap may not be a horrendous thing for the system in general, but it could lead to unnecessary bloat in applications that would otherwise be quite lean. It also lends itself to incompatibility with other versions of Java as you have found.

1
  • Yeah, just removed the java options variable and instead changed the argumants and now it works, thank you. Commented Dec 3, 2019 at 15:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .