IntelliJ IDEA之内存不够提示os::commit_memory failed

发现问题

平时的开发都很够跑,但是一搞微服务就GG了,内存占用太严重,需要加大内存了!!!

Error:Abnormal build process termination: 
D:\software\jdk10\bin\java.exe -Xmx700m -Djava.awt.headless=true -Djdt.compiler.useSingleThread=true "-Dpreload.project.path=D:/workspace/idea with spring/yytsg" -Dpreload.config.path=C:/Users/Administrator/.IdeaIC2018.1/config/options -Dcompile.parallel=false -Drebuild.on.dependency.change=true -Djava.net.preferIPv4Stack=true -Dio.netty.initialSeedUniquifier=2059834045735998548 -Dfile.encoding=GBK -Duser.language=zh -Duser.country=CN -Didea.paths.selector=IdeaIC2018.1 "-Didea.home.path=D:\software\IntelliJ IDEA Community Edition" -Didea.config.path=C:\Users\Administrator\.IdeaIC2018.1\config -Didea.plugins.path=C:\Users\Administrator\.IdeaIC2018.1\config\plugins -Djps.log.dir=C:/Users/Administrator/.IdeaIC2018.1/system/log/build-log "-Djps.fallback.jdk.home=D:/software/IntelliJ IDEA Community Edition/jre64" -Djps.fallback.jdk.version=1.8.0_152-release -Dio.netty.noUnsafe=true -Djava.io.tmpdir=C:/Users/Administrator/.IdeaIC2018.1/system/compile-server/microservice-tcbj-yytsg_17428220/_temp_ -Djps.backward.ref.index.builder=true -Dkotlin.incremental.compilation=true -Dkotlin.daemon.enabled -Dkotlin.daemon.client.alive.path=\"C:\Users\ADMINI~1\AppData\Local\Temp\kotlin-idea-1054983495127133799-is-running\" -classpath "D:/software/IntelliJ IDEA Community Edition/lib/jps-launcher.jar;D:/software/jdk10/lib/tools.jar;D:/software/IntelliJ IDEA Community Edition/lib/optimizedFileManager.jar" org.jetbrains.jps.cmdline.Launcher "D:/software/IntelliJ IDEA Community Edition/lib/jps-model.jar;D:/software/IntelliJ IDEA Community Edition/lib/netty-all-4.1.13.Final.jar;D:/software/IntelliJ IDEA Community Edition/lib/jna.jar;D:/software/IntelliJ IDEA Community Edition/lib/lz4-java-1.3.jar;D:/software/IntelliJ IDEA Community Edition/lib/log4j.jar;D:/software/IntelliJ IDEA Community Edition/lib/protobuf-java-3.0.0.jar;D:/software/IntelliJ IDEA Community Edition/lib/aether-dependency-resolver.jar;D:/software/IntelliJ IDEA Community Edition/lib/snappy-in-java-0.5.1.jar;D:/software/IntelliJ IDEA Community Edition/lib/platform-api.jar;D:/software/IntelliJ IDEA Community Edition/lib/aether-1.1.0-all.jar;D:/software/IntelliJ IDEA Community Edition/lib/annotations.jar;D:/software/IntelliJ IDEA Community Edition/lib/jdom.jar;D:/software/IntelliJ IDEA Community Edition/lib/resources_en.jar;D:/software/IntelliJ IDEA Community Edition/lib/jps-builders.jar;D:/software/IntelliJ IDEA Community Edition/lib/jps-builders-6.jar;D:/software/IntelliJ IDEA Community Edition/lib/httpcore-4.4.5.jar;D:/software/IntelliJ IDEA Community Edition/lib/maven-aether-provider-3.3.9-all.jar;D:/software/IntelliJ IDEA Community Edition/lib/forms_rt.jar;D:/software/IntelliJ IDEA Community Edition/lib/trove4j.jar;D:/software/IntelliJ IDEA Community Edition/lib/slf4j-api-1.7.10.jar;D:/software/IntelliJ IDEA Community Edition/lib/oro-2.0.8.jar;D:/software/IntelliJ IDEA Community Edition/lib/httpclient-4.5.2.jar;D:/software/IntelliJ IDEA Community Edition/lib/guava-21.0.jar;D:/software/IntelliJ IDEA Community Edition/lib/commons-codec-1.9.jar;D:/software/IntelliJ IDEA Community Edition/lib/asm-all.jar;D:/software/IntelliJ IDEA Community Edition/lib/idea_rt.jar;D:/software/IntelliJ IDEA Community Edition/lib/nanoxml-2.2.3.jar;D:/software/IntelliJ IDEA Community Edition/lib/commons-logging-1.2.jar;D:/software/IntelliJ IDEA Community Edition/lib/util.jar;D:/software/IntelliJ IDEA Community Edition/lib/jna-platform.jar;D:/software/IntelliJ IDEA Community Edition/lib/javac2.jar;D:/software/IntelliJ IDEA Community Edition/lib/jgoodies-forms.jar;D:/software/IntelliJ IDEA Community Edition/plugins/ant/lib/ant-jps-plugin.jar;D:/software/IntelliJ IDEA Community Edition/plugins/IntelliLang/lib/intellilang-jps-plugin.jar;D:/software/IntelliJ IDEA Community Edition/plugins/Groovy/lib/groovy-jps-plugin.jar;D:/software/IntelliJ IDEA Community Edition/plugins/Groovy/lib/groovy-rt-constants.jar;D:/software/IntelliJ IDEA Community Edition/plugins/eclipse/lib/eclipse-jps-plugin.jar;D:/software/IntelliJ IDEA Community Edition/plugins/eclipse/lib/common-eclipse-util.jar;D:/software/IntelliJ IDEA Community Edition/plugins/maven/lib/maven-jps-plugin.jar;D:/software/IntelliJ IDEA Community Edition/plugins/maven/lib/plexus-utils-2.0.6.jar;D:/software/IntelliJ IDEA Community Edition/plugins/gradle/lib/gradle-jps-plugin.jar;D:/software/IntelliJ IDEA Community Edition/plugins/devkit/lib/devkit-jps-plugin.jar;D:/software/IntelliJ IDEA Community Edition/plugins/Kotlin/lib/jps/kotlin-jps-plugin.jar;D:/software/IntelliJ IDEA Community Edition/plugins/Kotlin/lib/kotlin-stdlib.jar;D:/software/IntelliJ IDEA Community Edition/plugins/Kotlin/lib/kotlin-reflect.jar;D:/software/IntelliJ IDEA Community Edition/plugins/Kotlin/lib/kotlin-plugin.jar;D:/software/IntelliJ IDEA Community Edition/plugins/Kotlin/lib/android-extensions-ide.jar;D:/software/IntelliJ IDEA Community Edition/plugins/Kotlin/lib/android-extensions-compiler.jar;D:/software/IntelliJ IDEA Community Edition/plugins/javaFX/lib/javaFX-jps-plugin.jar;D:/software/IntelliJ IDEA Community Edition/plugins/javaFX/lib/common-javaFX-plugin.jar" org.jetbrains.jps.cmdline.BuildMain 127.0.0.1 56584 6bd58cb2-2a1e-49ee-befc-4c87df40e651 C:/Users/Administrator/.IdeaIC2018.1/system/compile-server
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 268435456 bytes for Failed to commit area from 0x00000000d4400000 to 0x00000000e4400000 of length 268435456.
# An error report file with more information is saved as:
# C:\Users\Administrator\.IdeaIC2018.1\system\compile-server\hs_err_pid24072.logJava HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000d4400000, 268435456, 0) failed; error='页面文件太小,无法完成操作。' (DOS error/errno=1455)

解决方案:

找到idea安装目录,打开idea.exe.vmoptions文件,进行编辑,加大各项参数。例如我的是

D:\software\IntelliJ IDEA Community Edition\bin\idea.exe.vmoptions

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

你可能感兴趣的:(IDEA,idea,commit_memory,内存)