- idea 2020.1.1 默认配置
-Xms128m -Xmx750m -XX:ReservedCodeCacheSize=240m -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -ea -XX:CICompilerCount=2 -Dsun.io.useCanonPrefixCache=false -Djdk.http.auth.tunneling.disabledSchemes="" -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Djdk.attach.allowAttachSelf=true -Dkotlinx.coroutines.debug=off -Djdk.module.illegalAccess.silent=true
- 调整后配置
-server -Xms610m -Xmx2g -XX:ReservedCodeCacheSize=512m -XX:+UseG1GC -XX:+UseStringDeduplication -XX:MaxGCPauseMillis=200 -XX:InitiatingHeapOccupancyPercent=85 -XX:G1HeapRegionSize=26 -XX:SoftRefLRUPolicyMSPerMB=50 -ea -XX:CICompilerCount=6 -Dsun.io.useCanonPrefixCache=false -Djdk.http.auth.tunneling.disabledSchemes="" -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Djdk.attach.allowAttachSelf=true -Dkotlinx.coroutines.debug=off -Djdk.module.illegalAccess.silent=true -Dfile.encoding=UTF-8
主要是修改了默认的垃圾回收器,将原来的 -XX:+UseConcMarkSweepGC 替换为 -XX:+UseG1GC ,并针对-XX:+UseG1GC进行相关参数配置,之所有会进行替换,是因为Idea官网目前最新的2021.3.2版本就是采用-XX:+UseG1GC