title: OutOfMemoryError: Java heap space on Tensorflow tests execution
body: <p>Executing Tensorflow test suite using command: </p>
  
  <pre><code>bazel test //tensorflow/...
  </code></pre>
  
  <p>throws Out of memory issue: </p>
  
  <pre><code>INFO: Found 1886 targets and 1155 test targets...
  INFO: Elapsed time: 291.775s, Critical Path: 0.91s
  java.lang.OutOfMemoryError: Java heap space
          at com.google.devtools.build.skyframe.SkyKey.create(SkyKey.java:57)
          at com.google.devtools.build.lib.skyframe.ArtifactSkyKey.key(ArtifactSkyKey.java:43)
          at com.google.devtools.build.lib.skyframe.ActionExecutionFunction.toKeys(ActionExecutionFunction.java:576)
          at com.google.devtools.build.lib.skyframe.ActionExecutionFunction.compute(ActionExecutionFunction.java:158)
          at com.google.devtools.build.skyframe.ParallelEvaluator$Evaluate.run(ParallelEvaluator.java:370)
          at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:501)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
          at java.lang.Thread.run(Thread.java:745)
  Java heap space
  
  bazel ran out of memory and crashed.
  </code></pre>
  
  <p>I have tried below options still issue persists. </p>
  
  <blockquote>
    <p>export _JAVA_OPTIONS="-Xms1024m -Xmx1024m"</p>
    
    <p>export JVM_ARGS="-Xmx1024m -XX:MaxPermSize=256m"</p>
    
    <p>export JVM_ARGS="-XX:PermSize=64M -XX:MaxPermSize=256m"</p>
  </blockquote>
  
  <p>Also, changed the file from bazel code: scripts/bootstrap/compile.sh</p>
  
  <p><code>" run "${JAVAC}" -J-Xms1g -J-Xmx1g -classpath "${classpath}" -sourcepath "${sourcepath}"</code>"</p>
  
  <p>Machine configurations: Ubuntu distribution, openjdk8, RAM 16G</p>