First of all I must say that I have long looked for a solution to my problem and that starting this thread is a desperate attempt. All the information (and their respective solutions) relate to memory leaks when running several iterations of a code or when dealing with heavy files (>500Mb). But that's not my case.
My code -before the error is triggered- looks like this:
library(tidyverse)
library(lubridate)
library(XLConnect)
library(tibble)
library(rJava)
path <- "file_path/file_name.xlsx"
wb <- loadWorkbook(path)
This triggers the following message:
Error: OutOfMemoryError (Java): Java heap space
The size of file is only 7Mb. If I try uploading a smaller file (500Kb) I get no error. I already tried setting a higher value for Java memory with options(java.parameters = "-Xmx8g") but it didn't solve the problem.
Garbage Collector looks like this:
used (Mb) gc trigger (Mb) max used (Mb)Ncells 1157125 61.8 2240345 119.7 2240345 119.7
Vcells 1793273 13.7 8388608 64.0 2904659 22.2
Does anyone have an idea of what could be causing this? My enviroment is completelly clean and I continously re-start my Rstudio session. The file is simply an .xlsx document that I need to load in order to fill columns with data from a dataframe.
readxlpackage might be an alternative, plus it's Java-free. There's alsoopenxlsxif you need to do more than reading files.openxlsx, but for this project I encountered an issue that could not be overcome, and so I need to useXLConnect(or, alternatively,xlsx; both Java-based). See: stackoverflow.com/questions/77556047/…