Friday, July 12, 2013

Java Heap size - R



I recently came across this error "
java.lang.OutOfMemoryError: Java heap space" when accessing large data sets from Mongodb with the RMongo package. 

Try to increase java Heap size(sufficient), by using:

options(java.parameters = "-Xmx3g")
Make sure that you are setting the Java parameters before any JVM is initialized, i.e. before packages are loaded.

That means on the R shell run

First: > options(java.parameters = "-Xmx3g")
Second: >  RMongo 

1 comment:

  1. Thank you very much!
    You've just saved my day: I've been struggled with this error since yesterday evening (I thought I would have had to make some dangerous change to some esoteric environmental variable in my fresh-new ubuntu)

    ReplyDelete

Add any comments if it helped :)