Skip to content

Instantly share code, notes, and snippets.

@dacr
Created July 23, 2013 20:40
Show Gist options
  • Save dacr/6065971 to your computer and use it in GitHub Desktop.
Save dacr/6065971 to your computer and use it in GitHub Desktop.
#!/bin/sh
exec scala -J-Xms80m -J-Xmx80m -deprecation -nocompdaemon "$0" "$@"
!#
def allocate(szInMb:Int=24) =
Array.fill[Byte](1024*1024*szInMb)(util.Random.nextInt(256).toByte)
def allocally[A](proc: => A) {proc}
def testit = {
val showStep = {var s=0 ; () => {s+=1 ; println(s"step$s")}}
allocally { showStep(); val x= allocate(20) }
allocally { showStep(); val x= allocate(20) }
allocally { showStep(); val x= allocate(20) }
allocally { showStep(); val x= allocate(20) }
}
testit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment