-
-
Save mikroskeem/c87c739d54dbd55a41dbb590d59be07f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func getFlags(desiredHeap int64) string { | |
asKb := desiredHeap / units.KiB | |
// the following is specific to OpenJ9 and is based on Aikar's flags: | |
// https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/ | |
// The equivalent of -XX:G1NewSizePercent/-XX:G1MaxNewSizePercent in OpenJ9's gencon policy is -Xmns/-Xmnx. | |
// We have to manually compute these values ourselves. By default, the gencon policy assumes 25% of Xms, which is | |
// simply not sufficient for Minecraft (and Aikar can tell you). | |
xmns := asKb / 2 | |
xmnx := asKb * 4 / 5 | |
memFlags := fmt.Sprintf("-Xms%dk -Xmx%dk -Xmns%dk -Xmnx%dk", asKb, asKb, xmns, xmnx) | |
return command := fmt.Sprintf("java -Xtune:virtualized -XX:+UseContainerSupport -Xgc:dnssExpectedTimeRatioMaximum=3 -Xgc:scvNoAdaptiveTenure %s -jar paper.jar", memoryFlags) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment