昨天在运行项目的时候,idea莫名其妙的闪退,一次是在启动了tomcat,登陆的时候,一次是在项目运行过程中,打开chrome浏览器的时候,搞的人很郁闷,还得重启idea,查杀tomcat进程。网上查了查,在C盘 C:\Users\Administrator 下面找到了几个idea的日志。下图中就是那几个日志。
将日志打开,开头就给出了可能的原因和一些建议,内容如下
# # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (malloc) failed to allocate 1637296 bytes for Chunk::new # Possible reasons: # The system is out of physical RAM or swap space # The process is running 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 # Check if swap backing store is full # Decrease Java heap size (-Xmx/-Xms) # Decrease number of Java threads # Decrease Java thread stack sizes (-Xss) # Set larger code cache with -XX:ReservedCodeCacheSize= # JVM is running with Unscaled Compressed Oops mode in which the Java heap is # placed in the first 4GB address space. The Java Heap base address is the # maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress # to set the Java Heap base and to place the Java Heap above 4GB virtual address. # 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