title: Zeppelin throws java.lang.OutOfMemoryError: Java heap space
body: <p>I am trying to use Zeppelin with the following code:</p>
  
  <pre class="lang-scala prettyprint-override"><code>val dataText = sc.parallelize(IOUtils.toString(new URL("http://XXX.XX.XXX.121:8090/my_data.txt"),Charset.forName("utf8")).split("\n"))
  
  
  case class Data(id: string, time: long, value1: Double, value2: int, mode: int)
  val dat = dataText .map(s =&gt; s.split("\t")).filter(s =&gt; s(0) != "Header:").map(
      s =&gt; Data(s(0), 
              s(1).toLong,
              s(2).toDouble,
              s(3).toInt,
              s(4).toInt
          )
  ).toDF()
  dat.registerTempTable("mydatatable")
  </code></pre>
  
  <p>this keeps throwing me following error :</p>
  
  <pre><code>java.lang.OutOfMemoryError: Java heap space
      at java.util.Arrays.copyOf(Arrays.java:2367)
      at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:130)
      at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:114)
      at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:535)
      at java.lang.StringBuilder.append(StringBuilder.java:204)
      at org.apache.commons.io.output.StringBuilderWriter.write(StringBuilderWriter.java:138)
      at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2002)
      at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1980)
      at org.apache.commons.io.IOUtils.copy(IOUtils.java:1957)
      at org.apache.commons.io.IOUtils.copy(IOUtils.java:1907)
      at org.apache.commons.io.IOUtils.toString(IOUtils.java:778)
      at org.apache.commons.io.IOUtils.toString(IOUtils.java:896)
      at $iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC.&lt;init&gt;(&lt;console&gt;:38)
      at $iwC$$iwC$$iwC$$iwC$$iwC$$iwC$$iwC.&lt;init&gt;(&lt;console&gt;:43)
      at $iwC$$iwC$$iwC$$iwC$$iwC$$iwC.&lt;init&gt;(&lt;console&gt;:45)
      at $iwC$$iwC$$iwC$$iwC$$iwC.&lt;init&gt;(&lt;console&gt;:47)
      at $iwC$$iwC$$iwC$$iwC.&lt;init&gt;(&lt;console&gt;:49)
      at $iwC$$iwC$$iwC.&lt;init&gt;(&lt;console&gt;:51)
      at $iwC$$iwC.&lt;init&gt;(&lt;console&gt;:53)
      at $iwC.&lt;init&gt;(&lt;console&gt;:55)
      at &lt;init&gt;(&lt;console&gt;:57)
      at .&lt;init&gt;(&lt;console&gt;:61)
      at .&lt;clinit&gt;(&lt;console&gt;)
      at .&lt;init&gt;(&lt;console&gt;:7)
      at .&lt;clinit&gt;(&lt;console&gt;)
      at $print(&lt;console&gt;)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.apache.spark.repl.SparkIMain$ReadEvalPrint.call(SparkIMain.scala:1065)
      at org.apache.spark.repl.SparkIMain$Request.loadAndRun(SparkIMain.scala:1338)
  </code></pre>
  
  <p>I have already set the following in the <code>zeppelin-env.sh</code></p>
  
  <p><code>export ZEPPELIN_JAVA_OPTS="-Dhdp.version=2.3.0.0-2557 -Dspark.executor.memory=4g"</code></p>
  
  <p>any idea what I may be missing. File I am parsing <code>my_data.txt</code> is about 200MB</p>
  
  <p>BTW I am using the Hortonworks Sandbox if that matters</p>
  
  <p><strong>EDIT 1</strong>
  Here is my <code>zeppelin-env.sh</code></p>
  
  <pre><code>export HADOOP_CONF_DIR=/etc/hadoop/conf
  export ZEPPELIN_PORT=9995
  export ZEPPELIN_JAVA_OPTS="-Dhdp.version=2.3.0.0-2557 -Dspark.executor.memory=4g"
  export SPARK_SUBMIT_OPTIONS="--driver-java-options -Xmx4g"
  export ZEPPELIN_INT_MEM="-Xmx4g"
  export SPARK_HOME=/usr/hdp/2.3.0.0-2557/spark
  </code></pre>
  
  <p>Regards
  Kiran </p>