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.

Adrian Pop
  • 285
  • 2
  • 17
  • 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. – yole Jul 01 '16 at 09:33
  • The memory used by the app. – Adrian Pop Jul 01 '16 at 09:36
  • Are you using a 32bit or 64bit version of Java, and is your operating system 32bit or 64bit. – Goibniu Jul 01 '16 at 10:41
  • @Goibniu I am using a 64bit version of Java on a 64bit OS – Adrian Pop Jul 01 '16 at 10:48
  • 1
    "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. – Peter Lawrey Jul 02 '16 at 06:55

3 Answers3

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.

ThomaRYLi
  • 51
  • 1
  • 2
3

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

RezaG
  • 31
  • 3
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.

yole
  • 92,896
  • 20
  • 260
  • 197
  • `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 same – Adrian Pop Jul 01 '16 at 10:05
  • 1
    Are you sure you have a 64-bit Java selected as the JDK to run your app in IntelliJ IDEA? – yole Jul 01 '16 at 10:50
  • Yes, it's the only JDK version installed. And as taken from the https://intellij-support.jetbrains.com/hc/en-us/articles/206544879-Selecting-the-JDK-version-the-IDE-will-run-under I set the proper path for `IDEA_JDK_64` – Adrian Pop Jul 01 '16 at 10:58
  • 1
    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. –  Jul 01 '16 at 15:20
  • 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. – yole Jul 01 '16 at 19:00