This is the equivalent core-libs bug for Hotspot's JDK-8292083. When the container memory exceeds the physical host's memory, the Java metrics reporting is wrong. Example (on a host with 32GB physical memory):
# podman run --memory 36G --memory-swap 36G --rm -ti -v $(pwd)/build/linux-x86_64-server-release/images/jdk/:/opt/jdk:z fedora:36
[root@71845cef857a /]# /opt/jdk/bin/java -XshowSettings:system -version
Operating System Metrics:
Provider: cgroupv1
Effective CPU Count: 8
CPU Period: 100000us
CPU Quota: -1
CPU Shares: -1
List of Processors, 8 total:
0 1 2 3 4 5 6 7
List of Effective Processors, 8 total:
0 1 2 3 4 5 6 7
List of Memory Nodes, 1 total:
0
List of Available Memory Nodes, 1 total:
0
Memory Limit: 36.00G
Memory Soft Limit: Unlimited
Memory & Swap Limit: 36.00G
Maximum Processes Limit: 2048
openjdk version "20-internal" 2023-03-21
OpenJDK Runtime Environment (build 20-internal-adhoc.sgehwolf.jdk-jdk)
OpenJDK 64-Bit Server VM (build 20-internal-adhoc.sgehwolf.jdk-jdk, mixed mode, sharing)
Expected 'Memory Limit: 32.00G' instead of the reported 'Memory Limit: 36.00G'