IntelliJ set heap size over 4GB. How to?
Asked Answered
D

3

6

I'm using IntelliJ 14.3 on x64 Java. Available memory: 10Gb (out of 16Gb total RAM)

(Basically set -Xmx8000M or greater)

The problem is I need more than 4Gb memory to use for an App. I can not find any answer or solution to my problem and I've looked for days.

I've been looking on stackoverflow for people asking the same question, but they had problems with the default value -Xmx512M and they kept linking to other answers, linking to another answer (waste of time and no solution so far).

I tried the following things that did not work:

  • Modifying the idea64.exe.vmoptions file for IntelliJ: didn't seem to do anything, no error, no memory increase, nothing. (it seemed as it ignored the file)
  • Using JAVA_OPTIONS in Environment Variables: Made IntelliJ crash on startup or freeze without using more memory than before.
  • Tried it with a lower value, of 1512M, same heap size problem
  • A fresh installation, even of the 15.x version of IntelliJ: nothing changed.

*Note:

  • someone at my workplace can set it in IntelliJ to work (but we can't figure out how

  • Running the class in command line with that -Xmx8000M seems to work, but I want to set it in IntelliJ for easy use

If anyone ran into this issue and can suggest solutions, I politely ask them to do so.

Default answered 1/7, 2016 at 9:31 Comment(5)
Do you want to change the memory used by IntelliJ itself, or by the app you start from IntelliJ? These are two completely different things, and you seem to confuse them.Gymnasium
The memory used by the app.Default
Are you using a 32bit or 64bit version of Java, and is your operating system 32bit or 64bit.Variometer
@Variometer I am using a 64bit version of Java on a 64bit OSDefault
"Tried it with a lower value, of 1512M, same heap size problem" This suggest to me that you are running on Win32 version of the JDK. It's the only version which has this limitation.Devisee
S
5

What worked for me was the following:

  1. Help -> Edit Custom VM Options, change to -Xmx8000M
  2. restart IntelliJ
  3. Run -> Edit Configurations -> Application -> your main class -> Configuration, add -Xmx8000M in the VM Options field.

Doing only 1) or 3) but not both didn't work for me.

Shauna answered 6/2, 2021 at 21:11 Comment(0)
I
3

Adding -Xmx10000M option to the bellow location worked for me: "Intellinj Idea -> Run -> Edit Configuration -> Modify Options -> Add VM Option"

Intermediary answered 14/12, 2020 at 23:48 Comment(0)
G
1

To specify the memory used by the app, specify the needed -Xmx option in the "VM options" field of the run configuration you use to start the app from IntelliJ IDEA.

Gymnasium answered 1/7, 2016 at 9:37 Comment(5)
Error: Could not create the Java Virtual Machine. Error occurred during initialization of VM Error: A fatal exception has occurred. Program will exit. Could not reserve enough space for object heap - I tried that before and it was the sameDefault
Are you sure you have a 64-bit Java selected as the JDK to run your app in IntelliJ IDEA?Gymnasium
Yes, it's the only JDK version installed. And as taken from the intellij-support.jetbrains.com/hc/en-us/articles/… I set the proper path for IDEA_JDK_64Default
Do double-check under Project Structure / Platform Settings / SDKs, that your JDK you're using is really the 64-bit one. The symptoms you describe sure sound like it's trying to allocate too much memory in a 32-bit JVM.Urethritis
Once again you're confusing the JDK used to run IDEA and the JDK used to run your app. IDEA_JDK_64 affects the former but is entirely irrelevant for the latter.Gymnasium

© 2022 - 2024 — McMap. All rights reserved.