提问者:小点点

OpenJDK MaxRAMPercentage 在具有非常大内存量的机器上


当在具有60GB内存(或更多)的机器上运行OpenJDK 11时,MaxRAMPercentage仅允许我分配最多30GB的内存。

这是正确的:

>~# java   -XX:MaxRAMPercentage=10 -XshowSettings:vm -version
VM settings:
    Max. Heap Size (Estimated): 5.90G
    Using VM: OpenJDK 64-Bit Server VM

openjdk version "11.0.4" 2019-07-16
OpenJDK Runtime Environment (build 11.0.4+11-post-Debian-1bpo91)
OpenJDK 64-Bit Server VM (build 11.0.4+11-post-Debian-1bpo91, mixed mode, sharing)

但是当百分比应该产生超过 30G 的堆大小时,我得到:

>~# java   -XX:MaxRAMPercentage=75 -XshowSettings:vm -version
VM settings:
    Max. Heap Size (Estimated): 29.97G
    Using VM: OpenJDK 64-Bit Server VM

openjdk version "11.0.4" 2019-07-16
OpenJDK Runtime Environment (build 11.0.4+11-post-Debian-1bpo91)
OpenJDK 64-Bit Server VM (build 11.0.4+11-post-Debian-1bpo91, mixed mode, sharing)

使用好的旧< code>-Xmx作品(例如< code >-xmx0g )。

我错过了什么?MaxRAMPercentage是否应该有界?


共1个答案

匿名用户

问题是与CompressedOops相关的 bug/功能(CompressedOops将堆大小限制为32GB,而-Xmx禁用CompressedOops,MaxRAMPer百分比不禁用)。

要解决/解决方法,您可以:

  • 添加-XX:-UseCompressedOops以禁用CompressedOops
  • 使用OpenJDK13,其中 bug 是固定的

错误报告在这里。感谢HT @Arnaud指引我去那里。