title: sbt java.io.IOException: Cannot run program "javac": java.io.IOException: error=12, Cannot allocate memory
body: <p>I tried to setup CI with the command <code>sbt -mem 2048 clean compile test</code> and I get the folloiwng</p>
  
  <pre><code>[info] Compiling 4 Scala sources and 8 Java sources to /opt/gitlab-6.2.2-0/apps/gitlabci/gitlabci-runner/tmp/builds/project-1/target/scala-2.10/classes...
  [warn] there were 2 feature warnings; re-run with -feature for details
  [warn] one warning found
  java.io.IOException: Cannot run program "javac": java.io.IOException: error=12, Cannot allocate memory
      at java.lang.ProcessBuilder.start(ProcessBuilder.java:488)
      at sbt.SimpleProcessBuilder.run(ProcessImpl.scala:386)
      at sbt.AbstractProcessBuilder.run(ProcessImpl.scala:138)
      at sbt.AbstractProcessBuilder$$anonfun$runBuffered$1.apply(ProcessImpl.scala:169)
      at sbt.AbstractProcessBuilder$$anonfun$runBuffered$1.apply(ProcessImpl.scala:169)
      at sbt.compiler.JavacLogger.buffer(AggressiveCompile.scala:178)
      at sbt.AbstractProcessBuilder.runBuffered(ProcessImpl.scala:169)
      at sbt.AbstractProcessBuilder.$bang(ProcessImpl.scala:166)
      at sbt.compiler.AggressiveCompile$$anonfun$forkJavac$1.apply(AggressiveCompile.scala:157)
      at sbt.compiler.AggressiveCompile$$anonfun$forkJavac$1.apply(AggressiveCompile.scala:152)
      at sbt.compiler.JavaCompiler$$anonfun$forkJavac$1.externalJavac$1(JavaCompiler.scala:82)
      at sbt.compiler.JavaCompiler$$anonfun$forkJavac$1$$anonfun$apply$2.apply(JavaCompiler.scala:83)
      at sbt.compiler.JavaCompiler$$anonfun$forkJavac$1$$anonfun$apply$2.apply(JavaCompiler.scala:83)
      at sbt.compiler.JavaCompiler$$anonfun$withArgumentFile$1.apply(JavaCompiler.scala:103)
      at sbt.compiler.JavaCompiler$$anonfun$withArgumentFile$1.apply(JavaCompiler.scala:100)
      at sbt.IO$.withTemporaryDirectory(IO.scala:281)
      at sbt.compiler.JavaCompiler$.withArgumentFile(JavaCompiler.scala:100)
      at sbt.compiler.JavaCompiler$$anonfun$forkJavac$1.apply(JavaCompiler.scala:83)
      at sbt.compiler.JavaCompiler$$anonfun$forkJavac$1.apply(JavaCompiler.scala:79)
      at sbt.compiler.JavaCompiler$$anonfun$directOrForkJavac$1.apply(JavaCompiler.scala:75)
      at sbt.compiler.JavaCompiler$$anonfun$directOrForkJavac$1.apply(JavaCompiler.scala:71)
      at sbt.compiler.JavaCompiler$$anon$1.compile(JavaCompiler.scala:57)
      at sbt.compiler.JavaTool$class.apply(JavaCompiler.scala:26)
      at sbt.compiler.JavaCompiler$$anon$1.apply(JavaCompiler.scala:51)
      at sbt.compiler.JavaCompiler$class.compile(JavaCompiler.scala:17)
      at sbt.compiler.JavaCompiler$$anon$1.compile(JavaCompiler.scala:51)
      at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1$$anonfun$apply$mcV$sp$1$$anonfun$apply$mcV$sp$2.apply$mcV$sp(AggressiveCompile.scala:83)
      at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1$$anonfun$apply$mcV$sp$1$$anonfun$apply$mcV$sp$2.apply(AggressiveCompile.scala:83)
      at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1$$anonfun$apply$mcV$sp$1$$anonfun$apply$mcV$sp$2.apply(AggressiveCompile.scala:83)
      at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:101)
      at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1$$anonfun$apply$mcV$sp$1.apply$mcV$sp(AggressiveCompile.scala:82)
      at sbt.classfile.Analyze$.apply(Analyze.scala:85)
      at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1.apply$mcV$sp(AggressiveCompile.scala:81)
      at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1.apply(AggressiveCompile.scala:81)
      at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1.apply(AggressiveCompile.scala:81)
      at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:101)
      at sbt.compiler.AggressiveCompile$$anonfun$4.compileJava$1(AggressiveCompile.scala:80)
      at sbt.compiler.AggressiveCompile$$anonfun$4.apply(AggressiveCompile.scala:88)
      at sbt.compiler.AggressiveCompile$$anonfun$4.apply(AggressiveCompile.scala:60)
      at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:24)
      at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:22)
      at sbt.inc.Incremental$.cycle(Incremental.scala:45)
      at sbt.inc.Incremental$.compile(Incremental.scala:29)
      at sbt.inc.IncrementalCompile$.apply(Compile.scala:20)
      at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:96)
      at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:44)
      at sbt.compiler.AggressiveCompile.apply(AggressiveCompile.scala:31)
      at sbt.Compiler$.apply(Compiler.scala:79)
      at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:572)
      at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:572)
      at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:578)
      at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:578)
      at scala.Function1$$anonfun$compose$1.apply(Function1.scala:49)
      at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311)
      at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311)
      at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:41)
      at sbt.std.Transform$$anon$5.work(System.scala:71)
      at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232)
      at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232)
      at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
      at sbt.Execute.work(Execute.scala:238)
      at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232)
      at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232)
      at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
      at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:679)
  Caused by: java.io.IOException: java.io.IOException: error=12, Cannot allocate memory
      at java.lang.UNIXProcess.&lt;init&gt;(UNIXProcess.java:164)
      at java.lang.ProcessImpl.start(ProcessImpl.java:81)
      at java.lang.ProcessBuilder.start(ProcessBuilder.java:470)
      at sbt.SimpleProcessBuilder.run(ProcessImpl.scala:386)
      at sbt.AbstractProcessBuilder.run(ProcessImpl.scala:138)
      at sbt.AbstractProcessBuilder$$anonfun$runBuffered$1.apply(ProcessImpl.scala:169)
      at sbt.AbstractProcessBuilder$$anonfun$runBuffered$1.apply(ProcessImpl.scala:169)
      at sbt.compiler.JavacLogger.buffer(AggressiveCompile.scala:178)
      at sbt.AbstractProcessBuilder.runBuffered(ProcessImpl.scala:169)
      at sbt.AbstractProcessBuilder.$bang(ProcessImpl.scala:166)
      at sbt.compiler.AggressiveCompile$$anonfun$forkJavac$1.apply(AggressiveCompile.scala:157)
      at sbt.compiler.AggressiveCompile$$anonfun$forkJavac$1.apply(AggressiveCompile.scala:152)
      at sbt.compiler.JavaCompiler$$anonfun$forkJavac$1.externalJavac$1(JavaCompiler.scala:82)
      at sbt.compiler.JavaCompiler$$anonfun$forkJavac$1$$anonfun$apply$2.apply(JavaCompiler.scala:83)
      at sbt.compiler.JavaCompiler$$anonfun$forkJavac$1$$anonfun$apply$2.apply(JavaCompiler.scala:83)
      at sbt.compiler.JavaCompiler$$anonfun$withArgumentFile$1.apply(JavaCompiler.scala:103)
      at sbt.compiler.JavaCompiler$$anonfun$withArgumentFile$1.apply(JavaCompiler.scala:100)
      at sbt.IO$.withTemporaryDirectory(IO.scala:281)
      at sbt.compiler.JavaCompiler$.withArgumentFile(JavaCompiler.scala:100)
      at sbt.compiler.JavaCompiler$$anonfun$forkJavac$1.apply(JavaCompiler.scala:83)
      at sbt.compiler.JavaCompiler$$anonfun$forkJavac$1.apply(JavaCompiler.scala:79)
      at sbt.compiler.JavaCompiler$$anonfun$directOrForkJavac$1.apply(JavaCompiler.scala:75)
      at sbt.compiler.JavaCompiler$$anonfun$directOrForkJavac$1.apply(JavaCompiler.scala:71)
      at sbt.compiler.JavaCompiler$$anon$1.compile(JavaCompiler.scala:57)
      at sbt.compiler.JavaTool$class.apply(JavaCompiler.scala:26)
      at sbt.compiler.JavaCompiler$$anon$1.apply(JavaCompiler.scala:51)
      at sbt.compiler.JavaCompiler$class.compile(JavaCompiler.scala:17)
      at sbt.compiler.JavaCompiler$$anon$1.compile(JavaCompiler.scala:51)
      at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1$$anonfun$apply$mcV$sp$1$$anonfun$apply$mcV$sp$2.apply$mcV$sp(AggressiveCompile.scala:83)
      at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1$$anonfun$apply$mcV$sp$1$$anonfun$apply$mcV$sp$2.apply(AggressiveCompile.scala:83)
      at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1$$anonfun$apply$mcV$sp$1$$anonfun$apply$mcV$sp$2.apply(AggressiveCompile.scala:83)
      at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:101)
      at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1$$anonfun$apply$mcV$sp$1.apply$mcV$sp(AggressiveCompile.scala:82)
      at sbt.classfile.Analyze$.apply(Analyze.scala:85)
      at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1.apply$mcV$sp(AggressiveCompile.scala:81)
      at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1.apply(AggressiveCompile.scala:81)
      at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1.apply(AggressiveCompile.scala:81)
      at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:101)
      at sbt.compiler.AggressiveCompile$$anonfun$4.compileJava$1(AggressiveCompile.scala:80)
      at sbt.compiler.AggressiveCompile$$anonfun$4.apply(AggressiveCompile.scala:88)
      at sbt.compiler.AggressiveCompile$$anonfun$4.apply(AggressiveCompile.scala:60)
      at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:24)
      at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:22)
      at sbt.inc.Incremental$.cycle(Incremental.scala:45)
      at sbt.inc.Incremental$.compile(Incremental.scala:29)
      at sbt.inc.IncrementalCompile$.apply(Compile.scala:20)
      at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:96)
      at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:44)
      at sbt.compiler.AggressiveCompile.apply(AggressiveCompile.scala:31)
      at sbt.Compiler$.apply(Compiler.scala:79)
      at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:572)
      at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:572)
      at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:578)
      at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:578)
      at scala.Function1$$anonfun$compose$1.apply(Function1.scala:49)
      at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311)
      at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311)
      at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:41)
      at sbt.std.Transform$$anon$5.work(System.scala:71)
      at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232)
      at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232)
      at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
      at sbt.Execute.work(Execute.scala:238)
      at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232)
      at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232)
      at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
      at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:679)
  [error] (compile:compile) java.io.IOException: Cannot run program "javac": java.io.IOException: error=12, Cannot allocate memory
  [error] Total time: 42 s, completed Nov 6, 2013 12:44:09 AM
  </code></pre>
  
  <p>The CI log is here: <a href="http://git.brut.us/gitlabci/projects/1/builds/d274440d0de549380bc5387085055ccc749803b9" rel="nofollow">http://git.brut.us/gitlabci/projects/1/builds/d274440d0de549380bc5387085055ccc749803b9</a></p>
  
  <p>and the project I'm trying to build is the sample from the akka book (source on github: <a href="https://github.com/RayRoestenburg/akka-in-action/tree/master/chapter2" rel="nofollow">https://github.com/RayRoestenburg/akka-in-action/tree/master/chapter2</a> )</p>
  
  <p>The project itself is pretty small, about 5 scala files. The machine which runs it has 4GB of ram. I am assuming there is some sbt configuration that needs to set the permsize a little bit lower so it doesnt consume all the ram (or maybe higher?). I looked around and the way to to this is very inconsistent and i've tried a few with no luck. </p>
  
  <p>sbt:</p>
  
  <pre><code>$ sbt -v
  # Executing command line:
  java
  -Xms1536m
  -Xmx1536m
  -XX:MaxPermSize=384m
  -XX:ReservedCodeCacheSize=192m
  -jar
  /usr/lib/sbt/sbt-launch.jar
  </code></pre>
  
  <p>sbt about : <code>This is sbt 0.12.0</code></p>
  
  <p>Any help would be appreciated! </p>