Home>Article>Backend Development> Detailed explanation of the 2GB upper limit of JVM memory in Linux systems

Detailed explanation of the 2GB upper limit of JVM memory in Linux systems

高洛峰
高洛峰 Original
2017-01-23 10:10:54 1647browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn