IDEA 学习之 编译内存问题

目录

      • [1. 正常的 IDEA build 日志](#1. 正常的 IDEA build 日志)
      • [2. 编译工具内存不足日志 (内存从小变大)](#2. 编译工具内存不足日志 (内存从小变大))
        • [2.1. 干脆无法启动](#2.1. 干脆无法启动)
        • [2.2. Ant 任务执行报错](#2.2. Ant 任务执行报错)
        • [2.3. 内存溢出:超出 GC 上限](#2.3. 内存溢出:超出 GC 上限)
        • [2.4. 内存溢出:超出 GC 上限,编译报错](#2.4. 内存溢出:超出 GC 上限,编译报错)
        • [2.5. 内存溢出: 堆空间](#2.5. 内存溢出: 堆空间)
        • [2.6. 内存溢出: 内存不足](#2.6. 内存溢出: 内存不足)
        • 解决方案

1. 正常的 IDEA build 日志

java 复制代码
Executing pre-compile tasks...
Loading Ant configuration...
Running Ant tasks...
Running 'before' tasks
Checking sources
Copying resources... [user]
Parsing java... [user]
java: JPS incremental annotation processing is disabled. Compilation results on partial recompilation may be inaccurate. Use build process "jps.track.ap.dependencies" VM flag to enable/disable incremental annotation processing environment.
Writing classes... [user]
Checking dependencies... [user]
Dependency analysis found 0 affected files
Updating dependency information... [user]
Adding @NotNull assertions... [user]
Adding pattern assertions... [user]
Adding the Threading Model assertions... [user]
Running 'after' tasks
javac 1.8.0_333 was used to compile java sources
Finished, saving caches...
Executing post-compile tasks...
Loading Ant configuration...
Running Ant tasks...
Synchronizing output directories...
2022/10/13, 10:04 AM - Build completed successfully with 2 warnings in 5 sec, 563 ms

2. 编译工具内存不足日志 (内存从小变大)

2.1. 干脆无法启动
2.2. Ant 任务执行报错
java 复制代码
Executing pre-compile tasks...
Loading Ant configuration...
Running Ant tasks...
Internal error (java.lang.NullPointerException): null
java.lang.NullPointerException
	at com.intellij.util.containers.hash.LinkedHashMap$Entry.access$200(LinkedHashMap.java:283)
	at com.intellij.util.containers.hash.LinkedHashMap.doRemoveEldestEntry(LinkedHashMap.java:137)
	at com.intellij.util.io.FilePageCache.ensureSize(FilePageCache.java:218)
	at com.intellij.util.io.FilePageCache.get(FilePageCache.java:186)
	at com.intellij.util.io.PagedFileStorage.getBufferWrapper(PagedFileStorage.java:370)
	at com.intellij.util.io.PagedFileStorage.getBuffer(PagedFileStorage.java:345)
	at com.intellij.util.io.PagedFileStorage.put(PagedFileStorage.java:246)
	at com.intellij.util.io.PagedFileStorage.fillWithZeros(PagedFileStorage.java:321)
	at com.intellij.util.io.PagedFileStorage.resize(PagedFileStorage.java:295)
	at com.intellij.util.io.ResizeableMappedFile.expand(ResizeableMappedFile.java:120)
	at com.intellij.util.io.ResizeableMappedFile.ensureSize(ResizeableMappedFile.java:89)
	at com.intellij.util.io.ResizeableMappedFile.putInt(ResizeableMappedFile.java:210)
	at com.intellij.util.io.PersistentEnumeratorBase.markDirty(PersistentEnumeratorBase.java:576)
	at com.intellij.util.io.PersistentEnumeratorBase.<init>(PersistentEnumeratorBase.java:143)
	at com.intellij.util.io.PersistentBTreeEnumerator.<init>(PersistentBTreeEnumerator.java:96)
	at com.intellij.util.io.PersistentEnumerator.createDefaultEnumerator(PersistentEnumerator.java:67)
	at com.intellij.util.io.PersistentMapImpl.<init>(PersistentMapImpl.java:136)
	at com.intellij.util.io.PersistentMapBuilder.buildImplementation(PersistentMapBuilder.java:62)
	at com.intellij.util.io.PersistentMapBuilder.build(PersistentMapBuilder.java:44)
	at com.intellij.util.io.PersistentHashMap.<init>(PersistentHashMap.java:39)
	at com.intellij.util.io.PersistentHashMap.<init>(PersistentHashMap.java:54)
	at org.jetbrains.jps.incremental.storage.AbstractStateStorage.createMap(AbstractStateStorage.java:116)
	at org.jetbrains.jps.incremental.storage.AbstractStateStorage.<init>(AbstractStateStorage.java:29)
	at org.jetbrains.jps.incremental.storage.FileTimestampStorage.<init>(FileTimestampStorage.java:27)
	at org.jetbrains.jps.incremental.storage.ProjectStamps.<init>(ProjectStamps.java:42)
	at org.jetbrains.jps.cmdline.BuildRunner.load(BuildRunner.java:102)
	at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:324)
	at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:175)
	at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:218)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:750)
Executing post-compile tasks...
Loading Ant configuration...
Running Ant tasks...
Synchronizing output directories...
2022/10/13, 9:51 AM - Build completed with 1 error and 0 warnings in 1 sec, 582 ms
2.3. 内存溢出:超出 GC 上限
java 复制代码
Executing pre-compile tasks...
Loading Ant configuration...
Running Ant tasks...
build: Project rebuild forced: Storage version updated, file = /Users/zxguan/Library/Caches/JetBrains/IntelliJIdea2022.1/compile-server/springcloud2_9578806c/timestamps/data
Cleaning output directories...
Running 'before' tasks
Checking sources
Copying resources... [user]
Parsing java... [user]
java: JPS incremental annotation processing is disabled. Compilation results on partial recompilation may be inaccurate. Use build process "jps.track.ap.dependencies" VM flag to enable/disable incremental annotation processing environment.
java: java.lang.OutOfMemoryError: GC overhead limit exceeded
java: java.lang.OutOfMemoryError: GC overhead limit exceeded
Checking dependencies... [user]
2.4. 内存溢出:超出 GC 上限,编译报错
java 复制代码
Executing pre-compile tasks...
Loading Ant configuration...
Running Ant tasks...
Running 'before' tasks
Checking sources
Copying resources... [user]
Parsing java... [user]
java: JPS incremental annotation processing is disabled. Compilation results on partial recompilation may be inaccurate. Use build process "jps.track.ap.dependencies" VM flag to enable/disable incremental annotation processing environment.
java: 系统资源不足。
java: 有关详细信息,请参阅以下堆栈跟踪。
java: java.lang.OutOfMemoryError: GC overhead limit exceeded
java:   at com.sun.tools.javac.util.List.of(List.java:135)
java:   at com.sun.tools.javac.util.List.append(List.java:272)
java:   at com.sun.tools.javac.comp.Resolve$MethodResolutionContext.addApplicableCandidate(Resolve.java:4338)
java:   at ......
java:   at ......
java: Compilation failed: internal java compiler error
Checking dependencies... [user]
Dependency analysis found 0 affected files
Errors occurred while compiling module 'user'
javac 1.8.0_333 was used to compile java sources
Finished, saving caches...
Executing post-compile tasks...
Loading Ant configuration...
Running Ant tasks...
Synchronizing output directories...
2022/10/13, 9:55 AM - Build completed with 2 errors and 1 warning in 12 sec, 377 ms
2.5. 内存溢出: 堆空间
java 复制代码
Executing pre-compile tasks...
Loading Ant configuration...
Running Ant tasks...
Running 'before' tasks
Checking sources
Copying resources... [user]
Parsing java... [user]
java: JPS incremental annotation processing is disabled. Compilation results on partial recompilation may be inaccurate. Use build process "jps.track.ap.dependencies" VM flag to enable/disable incremental annotation processing environment.
java: java.lang.OutOfMemoryError: Java heap space
java: java.lang.OutOfMemoryError: Java heap space
Checking dependencies... [user]
Dependency analysis found 0 affected files
Errors occurred while compiling module 'user'
javac 1.8.0_333 was used to compile java sources
Finished, saving caches...
Executing post-compile tasks...
Loading Ant configuration...
Running Ant tasks...
Synchronizing output directories...
2022/10/13, 9:55 AM - Build completed with 2 errors and 1 warning in 12 sec, 377 ms
2.6. 内存溢出: 内存不足
java 复制代码
Executing pre-compile tasks...
Loading Ant configuration...
Running Ant tasks...
Running 'before' tasks
Checking sources
Copying resources... [user]
Parsing java... [user]
java: JPS incremental annotation processing is disabled. Compilation results on partial recompilation may be inaccurate. Use build process "jps.track.ap.dependencies" VM flag to enable/disable incremental annotation processing environment.
java: 系统资源不足。
java: 有关详细信息,请参阅以下堆栈跟踪。
java:   at ......
java:   at ......
java:java.lang.OutOfMemoryError: insufficient memory
Checking dependencies... [user]
Dependency analysis found 0 affected files
Errors occurred while compiling module 'user'
javac 1.8.0_333 was used to compile java sources
Finished, saving caches...
Executing post-compile tasks...
Loading Ant configuration...
Running Ant tasks...
Synchronizing output directories...
2022/10/13, 9:55 AM - Build completed with 2 errors and 1 warning in 12 sec, 377 ms
解决方案

调大 IDEA 编译内存大小,File -> Settings -> Build, Execution, Deployment -> Compiler -> Shared build process heap size

相关推荐
程序媛小果几秒前
基于java+SpringBoot+Vue的宠物咖啡馆平台设计与实现
java·vue.js·spring boot
追风林6 分钟前
mac m1 docker本地部署canal 监听mysql的binglog日志
java·docker·mac
芒果披萨20 分钟前
El表达式和JSTL
java·el
阿伟来咯~31 分钟前
记录学习react的一些内容
javascript·学习·react.js
Suckerbin1 小时前
Hms?: 1渗透测试
学习·安全·网络安全
duration~1 小时前
Maven随笔
java·maven
水豚AI课代表1 小时前
分析报告、调研报告、工作方案等的提示词
大数据·人工智能·学习·chatgpt·aigc
zmgst1 小时前
canal1.1.7使用canal-adapter进行mysql同步数据
java·数据库·mysql
聪明的墨菲特i1 小时前
Python爬虫学习
爬虫·python·学习
跃ZHD1 小时前
前后端分离,Jackson,Long精度丢失
java