背景
早上在用IDEA构建项目的时候,爆出了以下问题。
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x000001faf3e50000, 65536, 0) failed; error='页面文件太小,无法完成操作。' (DOS error/errno=1455)
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 65536 bytes for Failed to commit area from 0x000001faf3e50000 to 0x000001faf3e60000 of length 65536.
# An error report file with more information is saved as:
# E:\project\hs_err_pid31108.log
错误信息
根据提示,直接找到对应的错误日志。
错误日志主要内容如下:
--------------- S U M M A R Y ------------
Command Line: -Dmaven.multiModuleProjectDirectory=E:\project\hs-mall\code\service\chuangyue-mall -Dmaven.home=D:\Program Files\apache-maven-3.8.1 -Dclassworlds.conf=D:\Program Files\apache-maven-3.8.1\bin\m2.conf -Dmaven.ext.class.path=D:\Program Files\JetBrains\IntelliJ IDEA 2021.3.2\plugins\maven\lib\maven-event-listener.jar -javaagent:D:\Program Files\JetBrains\IntelliJ IDEA 2021.3.2\lib\idea_rt.jar=61563:D:\Program Files\JetBrains\IntelliJ IDEA 2021.3.2\bin -Dfile.encoding=UTF-8 org.codehaus.classworlds.Launcher -Didea.version=2021.3.2 -s D:\Program Files\apache-maven-3.8.1\conf\settings.xml -Dmaven.repo.local=E:\repo clean install -P dev
Host: Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz, 16 cores, 31G, Windows 10 , 64 bit Build 19041 (10.0.19041.1566)
Time: Mon May 30 10:42:27 2022 中国标准时间 elapsed time: 46.413183 seconds (0d 0h 0m 46s)
--------------- T H R E A D ---------------
Current thread (0x0000011769c96000): JavaThread "C2 CompilerThread3" daemon [_thread_in_native, id=14764, stack(0x0000000d71700000,0x0000000d71800000)]
Current CompileTask:
C2: 46413 16870 ! 4 lombok.javac.JavacAST::drill (146 bytes)
Stack: [0x0000000d71700000,0x0000000d71800000]
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [jvm.dll+0x5f7e5a]
V [jvm.dll+0x77ff2e]
V [jvm.dll+0x7815ff]
V [jvm.dll+0x781cc3]
V [jvm.dll+0x247408]
...
--------------- P R O C E S S ---------------
Threads class SMR info:
...
Events (20 events):
Event: 45.849 loading class lombok/launch/Main
Event: 45.849 loading class lombok/launch/Main done
Event: 45.849 loading class lombok/launch/ShadowClassLoader
Event: 45.849 loading class lombok/launch/ShadowClassLoader done
Event: 45.920 loading class lombok/launch/AnnotationProcessorHider$AstModificationNotifierData
Event: 45.920 loading class lombok/launch/AnnotationProcessorHider$AstModificationNotifierData done
...
Dynamic libraries:
0x00007ff6cf5f0000 - 0x00007ff6cf5fd000 D:\Program Files\JDK\jdk11\bin\java.exe
0x00007ffb1caf0000 - 0x00007ffb1cce5000 C:\Windows\SYSTEM32\ntdll.dll
...
dbghelp: loaded successfully - version: 4.0.5 - missing functions: none
symbol engine: initialized successfully - sym options: 0x614 - pdb path: .;D:\Program Files\JDK\jdk11\bin;C:\Windows\SYSTEM32;C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.19041.1110_none_60b5254171f9507e;D:\Program Files\JDK\jdk11\bin\server;D:\Program Files\JetBrains\IntelliJ IDEA 2021.3.2\bin;C:\Users\Admin\AppData\Local\Temp
VM Arguments:
jvm_args: -Dmaven.multiModuleProjectDirectory=E:\project\hs-mall\code\service\chuangyue-mall -Dmaven.home=D:\Program Files\apache-maven-3.8.1 -Dclassworlds.conf=D:\Program Files\apache-maven-3.8.1\bin\m2.conf ...
[Global flags]
intx CICompilerCount = 12 {product} {ergonomic}
uint ConcGCThreads = 3 {product} {ergonomic}
uint G1ConcRefinementThreads = 13 {product} {ergonomic}
size_t G1HeapRegionSize = 2097152 {product} {ergonomic}
uintx GCDrainStackTargetSize = 64 {product} {ergonomic}
size_t InitialHeapSize = 536870912 {product} {ergonomic}
size_t MarkStackSize = 4194304 {product} {ergonomic}
...
Logging:
Log output configuration:
#0: stdout all=warning uptime,level,tags
#1: stderr all=off uptime,level,tags
Environment Variables:
略
--------------- S Y S T E M ---------------
OS: Windows 10 , 64 bit Build 19041 (10.0.19041.1566)
OS uptime: 7 days 0:10 hours
CPU:total 16 (initial active 16) (8 cores per cpu, 2 threads per core) family 6 model 165 stepping 5 microcode 0xc8, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, 3dnowpref, lzcnt, ht, tsc, tscinvbit, bmi1, bmi2, adx, fma
Memory: 4k page, system-wide physical 32701M (7169M free)
TotalPageFile size 68058M (AvailPageFile size 5M)
current process WorkingSet (physical memory assigned to process): 3380M, peak: 3380M
current process commit charge ("private bytes"): 3816M, peak: 3816M
vm_info: OpenJDK 64-Bit Server VM (11.0.11+9) for windows-amd64 JRE (11.0.11+9), built on Apr 20 2021 21:22:09 by "" with MS VC++ 15.9 (VS2017)
END.
根据log的内容分析,应该是内存撑不住,爆了。
我看了下我的操作,我发现因为我允许多项目启动。同时启动了多个服务和调试。
中间还有个XXL-job服务。我也是醉了。
所以导致项目内存不够了。
解决方案
那么很简单,直接把所有的项目stop掉,然后重新构建就可以了。
其实IDEA自带了Profiler窗口,你可以直接查看这个窗口就知道哪个占用了内存了。
总结
问题都会有的,关键是要稳住,不要慌,错误日志越多,定位问题就越简单。