Created
July 11, 2014 02:34
-
-
Save guersam/49c4dca01ee19e62700f to your computer and use it in GitHub Desktop.
SBT: MaxPermSize or MaxMetaspaceSize according to the current Java version
This file contains hidden or 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
javaOptions in (Test, test) := { | |
val versionParse = """(\d+)\.(\d+)""".r | |
val permOrMetaspace = | |
sys.props ("java.specification.version") match { | |
case versionParse (maj, min) => | |
val major = maj.toInt | |
val minor = min.toInt | |
if (major > 1 || major == 1 && minor >= 8) "Metaspace" else "Perm" | |
case _ => | |
sys.error ("Unable to determine Java version") | |
} | |
Seq("-Xmx256m", s"-XX:Max${permOrMetaspace}Size=128M") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment