昨天在运行项目的时候,idea莫名其妙的闪退,一次是在启动了tomcat,登陆的时候,一次是在项目运行过程中,打开chrome浏览器的时候,搞的人很郁闷,还得重启idea,查杀tomcat进程。网上查了查,在C盘 C:\Users\Administrator 下面找到了几个idea的日志。下图中就是那几个日志。
将日志打开,开头就给出了可能的原因和一些建议,内容如下
#
# Thereis insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate1637296 bytes for Chunk::new# Possible reasons:
# The systemis outof physical RAM or swap space
# The processisrunning with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap
# Possible solutions:
# Reduce memory load on the system
# Increase physical memory or swap space
# Checkif swap backing store isfull
# Decrease Java heap size (-Xmx/-Xms)
# Decrease number of Java threads
# Decrease Java thread stack sizes (-Xss)
# Set larger code cache with-XX:ReservedCodeCacheSize=# JVMis running with Unscaled Compressed Oops mode in which the Java heap is# placedin the first 4GB address space. The Java Heap base address isthe
# maximum limitfor the native heap growth. Please use -XX:HeapBaseMinAddress
# toset the Java Heap base and to place the Java Heap above 4GB virtualaddress.
# This output file may be truncated or incomplete.
#
...
英文不好,用网易有道词典翻译了一下,大概意思就是说内存不够用了,让我
1.减少系统的内存负载2.增加物理内存或交换空间3.减少Java堆大小(-Xmx/-Xms)4.减少Java线程的数量5.减少Java线程栈大小(-Xss)6.使用-XX设置更大的代码缓存:ReservedCodeCacheSize
看了看这几项,想到前几天我刚刚把idea的启动参数改了一下,将 idea64.exe.vmoptions 文件中的-Xms改为了1024m,-Xmx改为了2048m,会不会是改的太大了
所以才会有这个问题,于是我就改小了一点。
-server-Xms750m-Xmx1050m-Xverify:none-XX:ReservedCodeCacheSize=800m-XX:+UseConcMarkSweepGC-XX:SoftRefLRUPolicyMSPerMB=50
-ea-XX:CICompilerCount=2
-Dsun.io.useCanonPrefixCache=false
-Djava.net.preferIPv4Stack=true
-Djdk.http.auth.tunneling.disabledSchemes=""
-XX:+HeapDumpOnOutOfMemoryError-XX:-OmitStackTraceInFastThrow-Djdk.attach.allowAttachSelf=true
-Dkotlinx.coroutines.debug=off-Djdk.module.illegalAccess.silent=true
这个是现在的参数,改完以后,重启idea,正常开发。从昨天到现在一直没在出现过闪退的问题了。在这儿记录一下。
原文:https://www.cnblogs.com/anningkang/p/12033236.html
当IDEA出现无故闪退的情况,可能是由于内存不足导致。通过查看日志发现,系统提示内存分配失败。解决方案包括减少系统内存负载、增加物理内存、调整IDEA的启动参数等。作者修改了idea64.exe.vmoptions文件中的内存配置,将-Xms和-Xmx适当减小,之后IDEA运行正常,未再出现闪退问题。
2979

被折叠的 条评论
为什么被折叠?



