Some users reflect the Java applications running in Linux, and the memory can only be 2 GB. If you set the-xmx parameter to about 2 GB in the Java Virtual Machine (about
1.5-1.8 GB), the Java process cannot be started. We usually use 32-bit JVMs (64-bit JVMs will lose 10-20% performance, which is generally not recommended), while
The addressing space of 32-bit programs should be 4 GB. Why does the JVM on Linux only use 2 GB of memory?
After communicating with the jdk r & D team, I finally figured out some relevant reasons. This problem exists in earlier Linux versions, especially those earlier than kernel 2.5 and later than kernel 2.6.
Basically, there is no such problem. In the past, these Linux versions imposed a 2 GB memory limit on the process, which is the maximum size of memory blocks with a continuous address, and the JVM heap space (heap
Size) requires continuous address space. Therefore, 2 GB is the upper limit of memory used by Java processes theoretically.
(For more information, see Java, javafx, and Solaris.
Technical Exchange
Http://developers.sun.com.cn/blog/henry/
)
If a Java application requires a large amount of memory, we recommend that you use a newer version of Linux, or modify the Linux application/kernel memory ratio to 3 GB: 1 GB. There is also a choice such
Solaris and other UNIX operating systems. For operating systems such as Solaris, there is no 2 GB limit on memory management. Therefore, heap
Set the size to around 3.5-GB.