title: java: OutOfMemoryError: insufficient memory while running JUnits in Idea
body: <p>I am trying to run JUnits from my IntelliJ Idea
  When I try to run the Test.java file it gives me an error saying that</p>
  
  <blockquote>
    <p>java: OutOfMemoryError: insufficient memory</p>
  </blockquote>
  
  <p>I have tried increasing the memory allocated to Idea to as large as 6GB but it still gives me the same error, what am I missing :/</p>
  
  <p>Increasing the following in <strong>idea64.vmoptions</strong> didn't help. current vmoption settings in /opt/idea/bin are:</p>
  
  <pre><code>-Xms124m
  -Xmx2g
  -XX:MaxPermSize=2g
  -XX:ReservedCodeCacheSize=196m
  -XX:+UseCodeCacheFlushing
  -ea
  -Dsun.io.useCanonCaches=false
  -Djava.net.preferIPv4Stack=true
  </code></pre>
  
  <p>PS:- the project has ~83k files and overall size of project is 1.1 GB</p>
  
  <p>Below Error is encountered:- </p>
  
  <blockquote>
    <p>Information:Using javac 1.6.0_35 to compile java sources
    Information:java: The system is out of resources. Information:java:
    Consult the following stack trace for details. Information:java:  at
    com.sun.tools.javac.util.Position$LineMapImpl.build(Position.java:139)
    Information:java:     at
    com.sun.tools.javac.util.Position.makeLineMap(Position.java:63)
    Information:java:     at
    com.sun.tools.javac.parser.Scanner.getLineMap(Scanner.java:1105)
    Information:java:     at
    com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:512)
    Information:java:     at
    com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:550)
    Information:java:     at
    com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompiler.java:804)
    Information:java:     at
    com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727)
    Information:java:     at
    com.sun.tools.javac.main.Main.compile(Main.java:353) Information:java:
      at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:115)
    Information:java:     at
    org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:166)
    Information:java:     at
    org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:364)
    Information:java:     at
    org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:276)
    Information:java:     at
    org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:190)
    Information:java:     at
    org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:162)
    Information:java:     at
    org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:992)
    Information:java:     at
    org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:739)
    Information:java:     at
    org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:769)
    Information:java:     at
    org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:702)
    Information:java:     at
    org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:523)
    Information:java:     at
    org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:314)
    Information:java:     at
    org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:179)
    Information:java:     at
    org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:129)
    Information:java:     at
    org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:216)
    Information:java:     at
    org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:111)
    Information:java:     at
    org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run(BuildMain.java:132)
    Information:java:     at
    org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:41)
    Information:java:     at
    java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    Information:java:     at
    java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    Information:java:     at
    java.util.concurrent.FutureTask.run(FutureTask.java:138)
    Information:java:     at
    java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    Information:java:     at
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    Information:java:     at java.lang.Thread.run(Thread.java:662)
    Information:java: Errors occurred while compiling module 'app'
    Information:Compilation completed with 1 error and 0 warnings in 3 min
    19 sec Information:1 error Information:0 warnings Error:java:
    OutOfMemoryError: insufficient memory</p>
  </blockquote>
  
  <p><img src="https://i.stack.imgur.com/S7asr.png" alt="IDEA COMPILER SETTINGS"></p>