'JVM MaxHeapSize := 0 - what does this mean?
I have seen other questions on here like: How is the default max Java heap size determined? and Understanding java heap
I run the command to see my heap size java -XX:+PrintFlagsFinal -version and I get the output for MaxHeapSize:
uintx MaxHeapSize := 0 {product}
What does this mean?
Solution 1:[1]
This is a bug in JDK 8.
MaxHeapSize is defined in HotSpot sources as uintx, which stands for 64-bit unsigned integer.
In JDK 8, the format for printing uintx flag values is "%-16lu", which treats input as unsigned long.
However, the size of C++ unsigned long differs on Windows and Unix:
- Most Unix-like systems are LP64, where the size of
unsigned longis 64 bit. - Visual C++ on Windows is LLP64, where the size of
unsigned longis 32 bit.
So, JDK 8 on Windows prints only low 32 bits of uintx flags. That's why if MaxHeapSize is an exact multiple of 4 GiB, you'll see uintx MaxHeapSize := 0. This is just the printing error; the actual max heap size is correct.
The bug was fixed in JDK 9 as a part of JDK-8042893 change:
} else if (is_uintx()) {
- st->print("%-16lu", get_uintx());
+ st->print(UINTX_FORMAT_W(-16), get_uintx());
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | apangin |
