Skip to content

Instantly share code, notes, and snippets.

@dragos
Created October 9, 2017 12:45
Show Gist options
  • Save dragos/93b50aaf75640c6d484e41f085ee9290 to your computer and use it in GitHub Desktop.
Save dragos/93b50aaf75640c6d484e41f085ee9290 to your computer and use it in GitHub Desktop.
object Main {
private var things: Array[Object] = null
def allocate(size: Int): Unit = {
things = new Array[Object](size)
Array.fill(size)(new Object)
}
def main(args: Array[String]): Unit = {
val size: Int = args match {
case Array(n, _*) => Integer.parseInt(n)
case _ => 100000000
}
while (true) {
println()
println(s"Allocating $size elements")
allocate(size)
println("Press enter to run GC")
io.StdIn.readLine()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment