Intellij idea Heap size can not be changed

2019-07-24 23:54发布

Someday, I run something huge, and a window pop up said that heap memory out of memory, I set it to 2014M in that window, then click continue. Everything was fine.

But I don't like the number 2014, I want it 2048. So, I changed -Xmx option in idea64.exe.vmoptions (like below) and restarted idea. (According to this doc) However, nothing was changed, heap size was still 2014M.

-Xms512m
-Xmx2048m
-XX:ReservedCodeCacheSize=240m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow

enter image description here

Then, I changed all idea64.exe.vmoptions I could find, and restarted, and still failed.

enter image description here

OS: windows 10 64-bit
idea version: 2018.1

How can I change the heap size to 2048M ?

Please help, thanks.

update:

That day, I was debugging with some codes which encrypt some huge objects, and the popup showed just after I use copy value function.

I tried to change the heap size of IntelliJ Idea's JVM as the official document, but not working.

The heap memory statistic is here:

enter image description here

update 2:

The log:

2018-07-23 09:54:04,184 [    224]   INFO -        #com.intellij.idea.Main - JVM Args: -Xms512m -Xmx2048m -XX:ReservedCodeCacheSize=240m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Djb.vmOptionsFile=C:\Users\huayu\.IntelliJIdea2018.1\config\idea64.exe.vmoptions -Didea.jre.check=true -Dide.native.launcher=true -Didea.paths.selector=IntelliJIdea2018.1 -XX:ErrorFile=C:\Users\huayu\java_error_in_idea_%p.log -XX:HeapDumpPath=C:\Users\huayu\java_error_in_idea.hprof 

2条回答
Melony?
2楼-- · 2019-07-25 00:21

Newer versions of IDEA use a different file for vm options. Older versions used to use C:\Program Files\JetBrains\IntelliJ IDEA {version}\bin\idea64.exe.vmoptions but now these configurations exist in C:\Users{user}.IntelliJIdea{version}\config\idea64.exe.vmoptions.

You can get to this file from IntelliJ. On the Help menu, click Edit Custom VM Options. Then restart IDEA and it should update.

Note: It doesn't look like the value displayed in the bottom right will exactly match what you specify in the config file. Not sure why.

See also: How to increase the memory heap size on IntelliJ IDEA?

查看更多
走好不送
3楼-- · 2019-07-25 00:24

You changed the heap size of the project you were running within IntelliJ, not the heap size of IntelliJ itself, when you got to that popup. You would set that in the run configuration for your project.

The startup options change the heapsize of IntelliJ itself, which is not shown on screen constantly.

查看更多
登录 后发表回答