title: How to fix OutOfMemoryError (Java): GC overhead limit exceeded in r?
body: <p>I have to read a file in a list of folders and save data in R.
  I use following code for my test data and it works. When I use the code for the actual data then
   I get this error<br>
  Error: OutOfMemoryError (Java): GC overhead limit exceeded
  Called from: top level      </p>
  
  <p>This is what I have done for my test data</p>
  
  <pre><code>parent.folder &lt;- "C:/Users/sandesh/Desktop/test_R"
  sub.folder &lt;- list.dirs(parent.folder, recursive =TRUE)[-1]
  file &lt;- file.path(sub.folder, "sandesh1.xlsx")
  library(xlsx)
  library(plyr)
  fun &lt;- function(file) {
    df &lt;- read.xlsx(file, sheetIndex=1)
  }
  df.big &lt;- ldply(file, fun)
  </code></pre>