Scenario: building an Android project, “Could not reserve enough space for 2097152KB object heap”, the JAVA virtual machine memory is insufficient. The gradle JVM size of the project was changed to 1 gb.
Specifies gradle’s JVM memory scheme
Modify the gradle.properties file
org.gradle.jvmargs=-Xmx1024m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
The root cause of the problem is that the local JDK version is not 64-bit.
It is impossible to call heapsize larger than 4GB on a 32-bit Java virtual
Then I went to download the 64-bit JDK, stopped the Jenkins service, and upgraded the local JDK.
After the operation was completed, Jenkins was rebooted and the whole Jenkins became initialized, the installed components were also lost, and the Job task was also lost, as if everything needed to be reconfigured…
After further searching for the problem, Jenkins’ directory in Windows also changed after the JDK was upgraded from 32-bit to 64-bit.
Changed from C: Windows\SysWOW64\config\ SystemProfile \AppData\Local\Jenkins to C: Windows\SysWOW64\config\ SystemProfile \AppData\Local\Jenkins C:\Windows\System32\config\systemprofile\AppData\Local\Jenkins
Content under AppData\Local\Jenkins returned to normal.
Extending two questions
Windows64bit system compatible 32-bit application policy
C:\Windows\SysWOW64: data directory for 32-bit compatible applications
C:\Windows\System32: data directory for 64-bit applications
Microsoft’s official documentation explains why the name is so awkward
Because this is another Windows compatibility effort: an existing 32-bit application can be compiled into a 64-bit application and run on 64-bit Windows with little or no modification. In fact, System32 such path, write dead in the program, is not a case. So, to ensure a smooth transition to 64-bit for these applications, Windows finally decided to keep 64-bit system files in the System32 folder. We moved 32-bit system files into SysWow64.
Related links: docs.microsoft.com/zh-cn/archi…
Extended topic about JDK version selection.
At present, oracle JDK is not very convenient to download, and there is a potential commercial infringement risk, the following version of OpenJDK can be replaced and downloaded.
Azul Zulu its: www.azul.com/downloads/?…
Huawei – used JDK: www.hikunpeng.com/developer/d…
Amazon Corretto JDK: aws.amazon.com/cn/corretto…
Each has its own new features