CSR :
|
|
Relates :
|
|
Relates :
|
Summary ------- Exit the VM if users provide different `NewSize` and `MaxNewSize` when `InitialHeapSize` and `MaxHeapSize` are the same. Affects only Serial and Parallel GC. Problem ------- `MaxNewSize` can be silently ignored in certain cases. For example: ``` java -XX:+UseSerialGC -XX:InitialHeapSize=256m -XX:MaxHeapSize=256M -XX:NewSize=8M -XX:MaxNewSize=80M '-Xlog:gc,gc+heap=trace' --version ``` sets initial and maximum young generation size to 8 MB, meaning that `MaxNewSize=80M` is silently ignored, which can be surprising. This is especially true when `-XX:InitialHeapSize=256m` (or an even larger value) is derived from the default and implicit `InitialRAMPercentage`. Solution -------- Exit the VM with a warning to instruct users to adjust values for `NewSize/MaxNewSize` and/or `InitialHeapSize/MaxHeapsize`. Specification ------------- ``` // The maximum and initial heap sizes are the same, so the generation's // initial size must be the same as its maximum size. if (FLAG_IS_CMDLINE(NewSize) && FLAG_IS_CMDLINE(MaxNewSize) && NewSize != MaxNewSize) { vm_exit_during_initialization( "The MaxNewSize must be the same as NewSize because the MaxHeapSize and InitialHeapSize are the same."); } ```
|