当在具有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
是否应该有界?
问题是与CompressedOops相关的 bug/功能(CompressedOops将堆大小限制为32GB,而-Xmx
禁用CompressedOops,MaxRAMPer百分比
不禁用)。
要解决/解决方法,您可以:
-XX:-UseCompressedOops
以禁用CompressedOops错误报告在这里。感谢HT @Arnaud指引我去那里。