Skip to content

Commit

Permalink
Decrease 32-bit Windows usage
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhooper committed Apr 23, 2014
1 parent 03831de commit 4e820f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class JvmCommand(

private def is32BitMarker(is32Bit: Boolean) : Seq[String] = {
if (is32Bit) {
Seq("-Doverview.is32BitJava=true")
Seq("-server", "-Doverview.is32BitJava=true")
} else {
Seq()
}
Expand Down Expand Up @@ -92,6 +92,6 @@ object JvmCommand {
retval == 0
}

private val Max32BitHeapSize : Long = 1610612736 // 1.5g
private val Max32BitHeapSizeString : String = "1536m"
private val Max32BitHeapSize : Long = 1468006400
private val Max32BitHeapSizeString : String = "1400m"
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,26 @@ class JvmCommandSpec extends Specification {

"decrease heap sizes in with32BitSafe(false)" in {
val cmd = new JvmCommand(Seq(), Seq("-Xms3g", "-Xmx4000m", "-Xmn2000000k", "-Xint"), Seq())
cmd.with32BitSafe(false).jvmArgs.take(4) must beEqualTo(Seq("-Xms1536m", "-Xmx1536m", "-Xmn1536m", "-Xint"))
cmd.with32BitSafe(false).jvmArgs.take(4) must beEqualTo(Seq("-Xms1400m", "-Xmx1400m", "-Xmn1400m", "-Xint"))
}

"add -Doverview.is32BitJava=true in with32BitSafe(false)" in {
"add -server -Doverview.is32BitJava=true in with32BitSafe(false)" in {
val cmd = new JvmCommand(Seq(), Seq("-Xfoo"), Seq())
cmd.with32BitSafe(false).jvmArgs must beEqualTo(Seq("-Xfoo", "-Doverview.is32BitJava=true"))
cmd.with32BitSafe(false).jvmArgs must beEqualTo(Seq("-Xfoo", "-server", "-Doverview.is32BitJava=true"))
}

"not decrease heap sizes in with32BitSafe(true)" in {
val cmd = new JvmCommand(Seq(), Seq("-Xms3g", "-Xmx4000m", "-Xmn2000000k", "-Xint"), Seq())
cmd.with32BitSafe(true).jvmArgs.take(4) must beEqualTo(cmd.jvmArgs)
}

"not add -Doverview.is32BitJava=true in with32BitSafe(true)" in {
"not add -server -Doverview.is32BitJava=true in with32BitSafe(true)" in {
val cmd = new JvmCommand(Seq(), Seq("-Xfoo"), Seq())
cmd.with32BitSafe(true).jvmArgs must beEqualTo(Seq("-Xfoo"))
}

"not decrease heap sizes when they are small enough already" in {
val cmd = new JvmCommand(Seq(), Seq("-Xms1024m", "-Xmx1500m", "-Xmn200k", "-Xint"), Seq())
val cmd = new JvmCommand(Seq(), Seq("-Xms1024m", "-Xmx1350m", "-Xmn200k", "-Xint"), Seq())
cmd.with32BitSafe(false).jvmArgs.take(4) must beEqualTo(cmd.jvmArgs)
}
}
Expand Down

0 comments on commit 4e820f9

Please sign in to comment.