We usually use 32-bit JVMs (64-bit JVMs will lose 10-20% performance and are generally not recommended ), the addressing space of 32-bit programs should be 4 GB. Why does the JVM memory on Linux only use 2 GB?
After communicating with the jdk r & D team, I finally figured out some relevant reasons. This problem exists in some earlier Linux versions, especially those earlier than kernel 2.5. Later versions of kernel 2.6 basically do not have this 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. The heap size of JVM requires a continuous address space, therefore, 2 GB is the maximum memory used by java Process Theory.
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. In addition, select a UNIX operating system such as Solaris. For operating systems like Solaris, there is no 2 GB limit on JVM memory management. Therefore, you can set the heap size to around 3.5-GB.