0

I am trying to read data from an excel file(xlsx format) which is of size 100MB. While reading the excel data I am facing outOfMemoryException. Tried by increasing the JVM heap size to 1024MB but still no use and I cant increase the size more than that. Also tried by running garbage collection too but no use. Can any one help me on this to resolve my issue.

Thanks Pavan Kumar O V S.

1 Answers1

0

By default a JVM places an upper limit on the amount of memory available to the current process in order to prevent runaway processes gobbling system resources and making the machine grind to a halt. When reading or writing large spreadsheets, the JVM may require more memory than has been allocated to the JVM by default - this normally manifests itself as a java.lang.OutOfMemoryError.

For command line processes, you can allocate more memory to the JVM using the -Xms and -Xmx options eg. to allocate an initial heap allocation of 10 MB, with 100 MB as the upper bound you can use:

java -Xms10m -Xmx100m -classpath jxl.jar spreadsheet.xls

You can refer to http://www.andykhan.com/jexcelapi/tutorial.html#introduction for further details

demongolem
  • 9,474
  • 36
  • 90
  • 105
CyprUS
  • 4,159
  • 9
  • 48
  • 93