4

My result of a model in R says that

Error in .jcall(cellBlock$ref, "V", setDataMethod, as.integer(j - 1L),  : 
  java.lang.OutOfMemoryError: GC overhead limit exceeded

Could you please tell me what should I do for solving this issue?

drmariod
  • 11,106
  • 16
  • 64
  • 110

1 Answers1

1

This can mostly solved by reserving some arbitrary high amount of memory before loading the rjava package or xlsx.

options(java.parameters = "-Xmx4096m")
library(xlsx)

Sometimes this works fine, sometimes you need to restart the r session to make it work again. Somehow this is an issue with the garbage collection within java if to many functions are called in a to short amount of time. Couldn't solve it 100% until now :-(

EDIT: Regarding to this article, I already explained that it is important that the java settings are set before loading any package and also by adding another garbage collector. R Error: java.lang.OutOfMemoryError: Java heap space

options(java.parameters = c("-XX:+UseConcMarkSweepGC", "-Xmx8192m"))

So adding this line as the first line in the script, after restarting the r session, I've never had problems so far.

drmariod
  • 11,106
  • 16
  • 64
  • 110