0

I am trying to upload excel sheet of 10000 records and 29 columns but giving me out of memory error, to solve this in increase memory size in eclipe.ini file but no use. I decrease columns upto 4 then it doesn't give me error. but for more columns error is coming . Here with attached screenshot of errorenter image description here

Urmila
  • 1

1 Answers1

1

You should give more memory to you application, not to eclipse. Take a look at your run configuration and add -Xmx1024M (or more) to your VM arguments. If memory is still an issue, try using POI event API (https://poi.apache.org/spreadsheet/how-to.html#XSSF+and+SAX+%28Event+API%29)

Michal
  • 907
  • 7
  • 10
  • I am putting code where i m getting error while reading excel file – Urmila May 25 '18 at 09:05
  • List lstEmatrix = new ArrayList(); Properties prop = null; prop = ConnectionManager.getPropertiesObj(); String path = prop.getProperty("Export_File_Path"); try { FileInputStream file = new FileInputStream(new File(path + "/" + fileName)); XSSFWorkbook workbook = new XSSFWorkbook(file); XSSFSheet excelSheet = null ; – Urmila May 25 '18 at 09:06
  • while creating new XSSFWorkbook(file) i m getting error – Urmila May 25 '18 at 09:08
  • What kind of error? – Michal May 25 '18 at 09:28
  • Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at org.apache.xmlbeans.impl.store.Cur.createElementXobj(Cur.java:257) at org.apache.xmlbeans.impl.store.Cur$CurLoadContext.startElement(Cur.java:2992) at org.apache.xmlbeans.impl.store.Locale$SaxHandler.startElement(Locale.java:3198) at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.reportStartTag(Piccolo.java:1082) – Urmila May 25 '18 at 09:37
  • As I said you need to give more memory to your java process. If you start your app from eclipse see my response above (here is nice manual http://www.planetofbits.com/eclipse/increase-jvm-heap-size-in-eclipse/). If you are not sure that it worked use -Xmx2048m -Xms2048m as VM arguments and print result of Runtime.getRuntime().totalMemory() to stdout. That prints how much memory is your jvm using in bytes and result should be roughly 2048m bytes. If you cannot add more memory you cannot use XSSFWorkbook. In this case you will need to use POI event API – Michal May 25 '18 at 10:37
  • Thanks for reply – Urmila May 28 '18 at 13:00