当我使用gradle构建时,它失败并显示信息:
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000788800000, 89128960, 0) failed; error='无法分配内存' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 89128960 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /tmp/jvm-27885/hs_error.log
:app:transformClassesWithDexForBaiduDebug FAILED
:app:transformClassesWithDexForBaiduDebug (Thread[main,5,main]) completed. Took 25.305 secs.
系统内存还剩1G,我认为这已经足够了:
Mem: 3921316k total, 2735992k used, 1185324k free, 14464k buffers
Swap: 0k total, 0k used, 0k free, 90224k cached
添加我在gradle.properties中添加了一些参数但没有工作:
org.gradle.jvmargs=-Xms256m -Xmx1024m
还有其他方法可以修复此内存问题吗?
[解决] 更新后的物理内存和构建通过。