Intellij heap size, Initial heap size set to a larger value than the maximum heap size

依然范特西╮ 提交于 2019-12-05 14:54:26

问题


I'm a beginner in Java, and I just started using Intellij as my IDE.

When I use it, sometimes it's delayed.

I changed my xms and xmx for larger heap size (xms = 1024, xmx = 2048), but it throws an error.

So, I rolled it back.

The error message was something like this: "Initial heap size set to a larger value than the maximum heap size".

What is the problem?

If possible, how do I increase maximum heap size?

I'm using a laptop and it has 8GB memory. x64 Intellij.exe used.


回答1:


If you are seeing this error in InteliJ after the 2019.2 update it is because the update changed the JVM XMX value to 2048m without checking the related values which can allow XMS to become larger than the max XMX value which is not valid and creates that error.

i.e. The values for me had been XMX=6000m and XMS=4096m but after the 2019.2 update they were XMX=2048m and XMS=4096m

You will have to manually change the values so XMS is equal to or less than XMX. On Macs the VM options file is ~/Library/Preferences/IntelliJIdea2019.2/idea.vmoptions

NOTE: That path assumes you are on InteliJ version 2019.2. You will need to change that value in the path to the version you are on if




回答2:


I had the same issue on Linux. The configuration file is found in ~/.IntelliJIdea2018.2/config/idea64.vmoptions The directory will look like ~/.IntelliJIdeayyyy.n/config where yyyy is the year, and n is the release number in that year. Make sure that the -Xms value is higher than the -Xmx Here is my working config for ubuntu 18.04 with 8GB RAM

# custom IntelliJ IDEA VM options

-server
-Xms4096m
-Xmx4096m
-XX:NewSize=1024m
-XX:MaxNewSize=1512m
-XX:NewRatio=1
-XX:+UseParNewGC
-XX:ParallelGCThreads=4
-XX:MaxTenuringThreshold=1
-XX:SurvivorRatio=8
-XX:+UseCodeCacheFlushing
-XX:+UseConcMarkSweepGC
-XX:+AggressiveOpts
-XX:+CMSClassUnloadingEnabled
-XX:+CMSIncrementalMode
-XX:+CMSIncrementalPacing
-XX:+CMSParallelRemarkEnabled
-XX:CMSInitiatingOccupancyFraction=65
-XX:+CMSScavengeBeforeRemark
-XX:+UseCMSInitiatingOccupancyOnly
-XX:ReservedCodeCacheSize=64m
-XX:-TraceClassUnloading
-ea
-Dsun.io.useCanonCaches=false



回答3:


I had the same issue in IntelliJ in MAC.

There is a build process heap size configuration in IntelliJ. You can find this setting in

Preferences > Compiler > Build Process Heap Size

Make sure the Xmx value(in the environment or VM options) is lower than the value in settings. If not either increase Build Process Heap Size in IntelliJ settings or reduce Xmx value in VM options.

By default Build Process Heap Size will be 700m.




回答4:


Use Help | Edit Custom VM Options, change -Xmx value only to 2GB or whatever value you need, -Xms value should be lower or the same. Note that too high heap can make GC pauses much longer.

You problem may be not related to memory settings at all. The proper way of reporting performance issues is described in this document. You need to capture a CPU snapshot and submit it to JetBrains support or the issue tracker.



来源:https://stackoverflow.com/questions/47066443/intellij-heap-size-initial-heap-size-set-to-a-larger-value-than-the-maximum-hea

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!