问题
I know this issue has been visited several times, but I haven't found the solution to my problem:
I reserve 1024 MB for the virtual machine with
> options(java.parameters = "-Xmx1024m")
> library(XLConnect)
xlcMemoryReport finds only around 15 MB and xlcFreeMemory doesn't help (actually sometimes further reduces available memory)
> xlcMemoryReport()
Amount of free memory in the Java Virtual Machine (JVM): 14.79472 MB
> xlcFreeMemory()
> xlcMemoryReport()
Amount of free memory in the Java Virtual Machine (JVM): 15.05308 MB
when I try to load a 26 MB file it fails, but actually frees up the memory:
> res <- readWorksheet(loadWorkbook("bigFile.xlsx"),sheet=1)
error in evaluating the argument 'object' in selecting a method for function 'readWorksheet': Error: OutOfMemoryError (Java): Java heap space> xlcMemoryReport()
Amount of free memory in the Java Virtual Machine (JVM): 947.3003 MB> res <- readWorksheet(loadWorkbook("bigFile.xlsx"),sheet=1)
error in evaluating the argument 'object' in selecting a method for function 'readWorksheet': Error: OutOfMemoryError (Java): Java heap space> xlcMemoryReport()
Amount of free memory in the Java Virtual Machine (JVM): 936.7464 MB
- Why xlcMemoryReport does not find the reserved memory at first but finds it after I try reading the file?
- Is it possible that >900 MB is not sufficient for XLConnect to load a 26 MB file?
- Any idea how I can make this work? (of course I could use CSV files, but that is an inconvenience for my users)
来源:https://stackoverflow.com/questions/22145260/xlconnect-java-virtual-machine-out-of-memory-error