JVM memory limit of 2 GB in Linux

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.