XLConnect Java Virtual Machine out of memory error

泪湿孤枕 提交于 2020-01-14 04:52:06

问题


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

  1. Why xlcMemoryReport does not find the reserved memory at first but finds it after I try reading the file?
  2. Is it possible that >900 MB is not sufficient for XLConnect to load a 26 MB file?
  3. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!