Skip to content

Commit

Permalink
Fix UseZGC parameter ordering when used with JDK 11, Fixes #54 (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
burmanm authored Jul 19, 2024
1 parent 39a6ddd commit 6d6f0ac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/config/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,11 @@ func getGCOptions(gcName string, jvmMajor int) []string {
case "Shenandoah":
return []string{"-XX:+UseShenandoahGC"}
case "ZGC":
zgcOpts := []string{"-XX:+UseZGC"}
zgcOpts := make([]string, 0, 1)
if jvmMajor < 17 {
zgcOpts = append(zgcOpts, "-XX:+UnlockExperimentalVMOptions")
}
zgcOpts = append(zgcOpts, "-XX:+UseZGC")
return zgcOpts
default:
// User needs to define all the settings
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ func TestGCOptions(t *testing.T) {
assert.Equal([]string{"-XX:+UseShenandoahGC"}, getGCOptions("Shenandoah", 11))
assert.Equal([]string{"-XX:+UseShenandoahGC"}, getGCOptions("Shenandoah", 17))

assert.Equal([]string{"-XX:+UseZGC", "-XX:+UnlockExperimentalVMOptions"}, getGCOptions("ZGC", 11))
assert.Equal([]string{"-XX:+UnlockExperimentalVMOptions", "-XX:+UseZGC"}, getGCOptions("ZGC", 11))
assert.Equal([]string{"-XX:+UseZGC"}, getGCOptions("ZGC", 17))
}

Expand Down

0 comments on commit 6d6f0ac

Please sign in to comment.