34

I want to allocate around 1GB of heap size, but I can't seem to figure it out.

How to do this?

N8888
  • 670
  • 2
  • 14
  • 20
ocespedes
  • 1,233
  • 4
  • 14
  • 27

10 Answers10

60

Use Help | Edit Custom VM Options…

VM Options

An editor will open automatically for the right .vmoptions file, adjust the value of -Xmx, save and restart IntelliJ IDEA:

editor

Check these documents from IntelliJ IDEA knowledge base for more details:

Answers below suggest to edit .vmoptions file directly inside the application installation directory. Please note that it's not recommended since it will cause conflicts during patch updates. The method above creates a copy of the file in the CONFIG directory and your IDE installation remains intact.

Also be aware of the 32-bit address space limit on Windows which makes it hard to use heap sizes higher than 750m. Should you need to use larger heap, make sure to switch to the 64-bit JVM first, otherwise IDE may crash on start or start to crash randomly during work.

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • 1
    Important to note that there is a 32bit and 64bit version of the config. – brasskazoo Oct 29 '14 at 05:16
  • This is a good method but not always effective. This method increases heap for the IDE but not for the other java processes the IDE runs in the background. I ran into this when copying data between DB sources and kept getting `java.lang.OutOfMemoryError: Java heap space `. Overriding `.vmoptions` file next to `idea64.exe` was the solution. The background JVM's get it from there. – Juan Javier Triff Cabanas Feb 02 '23 at 19:05
21

go to that path "C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.1.4\bin\idea.exe.vmoptions" and change size to -Xmx512m

  -Xms128m
  -Xmx512m
  -XX:MaxPermSize=250m
  -XX:ReservedCodeCacheSize=64m
  -XX:+UseCodeCacheFlushing
  -ea
  -Dsun.io.useCanonCaches=false
  -Djava.net.preferIPv4Stack=true

hope its will work

Rinkesh
  • 3,150
  • 28
  • 32
13

For 64-bit Windows, make sure to run idea in 64 bit mode(idea64.exe) and change settings in "C:\Program Files (x86)\JetBrains\IntelliJ IDEA 15.0.1\bin\idea64.exe.vmoptions" file. These settings works fine for me

-Xms512m
-Xmx2024m
-XX:MaxPermSize=700m
-XX:ReservedCodeCacheSize=480m
Yuriy Kvartsyanyy
  • 2,656
  • 2
  • 14
  • 16
5

For developers who use Ubuntu, following will help to increase heap size in InteliJ Idea. Following versions are used by myself at the moment.

  • Ubuntu 16.04 LTS (64 bit)

  • InteliJ IDEA 2016.3.4

Go to the location where the IDE is installed and find the following file. (In my case it as follows)

/home/abcde/Softwares/idea-IU-163.12024.16/bin

Then select the idea64.vmoptions file and edit it.

Remove default configuration and paste the below mentioned.

-Xms512m
-Xmx2024m
-XX:MaxPermSize=700m
-XX:ReservedCodeCacheSize=480m

Now restart the IDE and changes should reflect the IDE environment.

Worked for me to overcome Java heap size related issues.

Du-Lacoste
  • 11,530
  • 2
  • 71
  • 51
5

If you use JetBrains Toolbox, then memory changes must be set inside it:

  1. Go to the app settings in the toolbox list
  2. Change Memory heap size option within Configuration section

Otherwise all the changes in the IDE itself or inside vmoptions file just don't apply.

Click Settings icon of the correspoinding IDE

Change heap size

Dmitry Nevzorov
  • 595
  • 8
  • 16
3

You can easily increase memory heap from IntelliJ IDEA version 2019.2 by using IDE main menu Help | Change Memory Settings.

Please check this document for details: https://www.jetbrains.com/help/idea/increasing-memory-heap.html

floating cat
  • 678
  • 7
  • 11
2

In addition to what others have added, should the error persist try this

increase the memory heap size_0

increase the memory heap size_1

increase the memory heap size_2

basically put what you want(as others have pointed out) in your run-config's vm options and apply

linker
  • 821
  • 1
  • 8
  • 20
1

Make sure you check your environment variables also. Mine was not updating until I changed my _JAVA_OPTIONS value from -Xmx512m to -Xmx2048m.

0

Right click on the play button then modify run configuration then build and run modify option select add vm option this will add a text box now give the values like: -Xmx7g

NoBody
  • 9
  • 2
0

I am using the below version of Intellij, and simply u can just click on

Help => Change Memory Settings

enter image description here

Ikbel
  • 1,817
  • 1
  • 17
  • 30