RFR: 8047998: -XX:InitialHeapSize is unnecessarily set to MaxHeapSize

Guoxiong Li gli at openjdk.org
Tue May 9 03:31:29 UTC 2023


Hi all,

When `MaxHeapSize` is equal to `InitialHeapSize` and `NewSize` is set in command line,
currently, the `max_young_size/MaxNewSize` will be set to the value of `NewSize`.

Considering the document of the `NewSize` (shown below), someone may set the `NewSize` 
to a very small value and expect the JVM to adjust the value dynamically.
Then when the `MaxHeapSize` is equal to `InitialHeapSize` (set by user or ergonomics),
the `MaxNewSize` is set to the value of `NewSize`, which is small unexpectedly.


  product(size_t, NewSize, ScaleForWordSize(1*M),                           \
          "Initial new generation size (in bytes)")                         \
          constraint(NewSizeConstraintFunc,AfterErgo)                       \


This patch fixes the issue by setting the `MaxNewSize` to `NewSize` only when the `NewSize` 
is larger than the original `max_young_size/MaxNewSize`.

The title of JDK-8047998 may need to adjusted.

Thanks for the review.

Best Regards,
-- Guoxiong

-------------

Commit messages:
 - JDK-8047998

Changes: https://git.openjdk.org/jdk/pull/13876/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13876&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8047998
  Stats: 8 lines in 1 file changed: 5 ins; 2 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/13876.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13876/head:pull/13876

PR: https://git.openjdk.org/jdk/pull/13876


More information about the hotspot-gc-dev mailing list