Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

OutofMemory Exception while parsing large xlsx

 
Sairam Pareek
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a 6.33 MB size xlsx file which i am trying to read. One file is read successfully but when I try to read multiple (4) same files concurrently I am getting "outofmemory: java heap space".

Is there any workaround for this.

I have set the heap size to 512mb and using the latest poi libraries poi-ooxml-3.8-20120326.jar.

below is the code sample code:



ERROR:

 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
POI is a memory hog for large files; set that limit to 1GB and see what happens. And, of course, don't process files concurrently.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch Sairam Pareek
 
Jelle Klap
Bartender
Posts: 1951
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, I'd say scale the number of threads back to 1 and profile the memory usage for a typical set of .xlsx files. Depending on what you actually need from the .xlsx files you might be able to get away with changing your parsing strategy also.
 
Sairam Pareek
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for all the suggestions and sorry for delay in response.

Below post solved my problem:

http://www.myjeeva.com/2012/11/read-excel-through-java-using-xssf-and-sax-apache-poi/
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic