Home > Article > Backend Development > Detailed explanation of the 2GB upper limit of JVM memory in Linux systems
The JVMs we usually use are all 32-bit (a 64-bit JVM will lose 10-20% of performance and is generally not recommended), and the addressing space of a 32-bit program should be 4GB. Why on Linux? The JVM memory can only use 2GB?
After communicating with the staff of the JDK R&D team, I finally figured out some related reasons. This problem exists in some early Linux versions, especially versions before kernel 2.5. Versions after 2.6 basically do not have this problem. It turns out that these Linux versions have a 2GB memory limit for processes, which is the upper limit of the size of a memory block with consecutive addresses, and the JVM's heap space (heap size) requires a continuous address space. Therefore, 2GB is the theoretical use of the Java process. Memory limit.
If the Java application needs to use larger memory, it is recommended to use a newer version of Linux, or modify the Linux application/kernel memory ratio configuration to 3GB:1GB. There is also the option of choosing a UNIX operating system such as Solaris. Operating systems like Solaris do not have a 2GB limit on JVM memory management, so the heap size can be set to about 3.5-3.6GB.
For more detailed explanations of the 2GB upper limit of JVM memory in Linux systems, please pay attention to the PHP Chinese website!