简体   繁体   中英

Java heap space error in R 32 bit

I am facing an error in R while trying to use read.xlsx function from package xlsx . Error says "

Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, : java.lang.OutOfMemoryError: Java heap space

I have tried using openxlsx package and it works fine but I want to use xlsx package only. I have also tried setting java parameters to increase the heap space after unloading all the packages from R session but it doesn't work. I am using 32 bit R, 32 bit Java on a 64 bit system and have declared all possible paths in my environment variables.

Thanks a lot for the help!

I somehow had this problem in a not reproducible manner, partly solved it with -Xmx8g but run in to problems randomly.

I described an option with a different garbage collector here by using

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

at the beginning of the script and before any other package is loaded since other packages can load some java things by themselves and the options have to be set before any Java is loaded.

So far, the problem didn't occurred again.

Only sometimes in a long session it can still happen. But in this case a session restart normally solves the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM