title: R Error: java.lang.OutOfMemoryError: Java heap space
body: <p>I am trying to connect R to Teradata to pull data directly into R for analysis. However, I am getting the error of,</p>
  
  <pre><code>Error in .jcall(rp, "I", "fetch", stride, block) :
    java.lang.OutOfMemoryError: Java heap space
  </code></pre>
  
  <p>I have tried to set up my R options to increase the max heap size of JVM by doing:</p>
  
  <pre><code>options(java.parameters = "-Xmx8g")
  </code></pre>
  
  <p>I have also tried to initialize java parameters with rJava function <code>.jinit</code> as: <code>.jinit(parameters="-Xmx8g")</code>. 
  But still failed.</p>
  
  <p>The calculated size of the data should be approximately 3G (actually less than 3G).</p>