Last active
December 20, 2015 03:49
-
-
Save dacr/6065956 to your computer and use it in GitHub Desktop.
conceptual block doest not zero out references, so the following code fails with an OutOfMemoryError.
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
#!/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 testit = { | |
val showStep = {var s=0 ; () => {s+=1 ; println(s"step$s")}} | |
{ showStep(); val x= allocate(20) } | |
{ showStep(); val x= allocate(20) } | |
{ showStep(); val x= allocate(20) } | |
{ showStep(); val x= allocate(20) } | |
} | |
testit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment