Possible solutions for Idea leading to high memory consumption and high CPU occupancy:
1. Modify the VM options value corresponding to the Configurations configuration of the project
Xmx
: The maximum value of Java Heap . The default value is 1/4 of the physical memory. The optimal setting value should depend on the size of the physical memory and other memory overheads in the computer.Xms
: The initial value of Java Heap , it is better to set -Xms and -Xmx to the same value for the JVM on the server side, and the JVM of the development test machine can keep the default value.Xmn
: The size of the Java Heap Young area. If you are not familiar with it, it is best to keep the default value.Xss
: The Stack size of each thread, it is best to keep the default value if you are not familiar with it;
vm options
dea64.exe.vmoptions
Optimization (to avoid the problem of not optimizing the relevant configuration will be very stuck, and hot loading will be very slow), modify the files in the bin directory under Idea
-Xms1024m
-Xmx1024m
-XX:MaxMetaspaceSize=512m
-XX:MetaspaceSize=512m
-XX:InitialBootClassLoaderMetaspaceSize=64M
-XX:NewRatio=2
-XX:SurvivorRatio=8
-XX:MaxTenuringThreshold=6
-XX:+UseConcMarkSweepGC
-XX:CMSFullGCsBeforeCompaction=5
-XX:+CMSParallelRemarkEnabled
-XX:+CMSClassUnloadingEnabled
-Xss1024k
-XX:+DisableExplicitGC
-XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses
-XX:ReservedCodeCacheSize=240m
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-XX:+PrintGCDetails
-XX:+PrintGCTimeStamps
-Xloggc:D:/temp/gclog/idea.gc.log
-XX:+PrintHeapAtGC
2. Use the plugin choose runtime
idea
The essential reason for the lag is that the runningjre
environment is different from the project's compilation environment.
For example,idea2019
the version already uses its own packagedjre11
version by default, and my project usesjdk1.8
the version. The old version of the idea itselfSwitch Boot SDK
can be switched through functions, but the new version is no longer To provide this function, you need to use the idea plugin –choose runtime
Download the idea pluginChoose Runtiome
Double-click shift
global search, enter choose runtime
, and then double-click to open . After
clicking install
successfully, restart idea. Double-click shift to global search choose runtime
, and you can see that it has been enabled.
This solution comes from Baidu- Little Pony Myles , which completely solves the serious memory consumption and CPU resource ratio of Idea . The problem