3

在具有 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)

使用好的旧-Xmx作品(例如-Xmx50G)。

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

4

1 回答 1

11

问题是与CompressedOops相关的错误/功能(CompressedOops 将堆大小限制为 32GB,而-Xmx禁用 CompressedOops 时MaxRAMPercentage不会)。

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

  • 添加-XX:-UseCompressedOops以禁用 CompressedOops
  • 使用 OpenJDK13,bug 已修复

错误报告在这里。HT @Arnaud 指导我去那里。

于 2019-09-26T16:45:27.410 回答