aspose file tools*
The moose likes Java in General and the fly likes OutofMemory Exception while parsing large xlsx Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "OutofMemory Exception while parsing large xlsx" Watch "OutofMemory Exception while parsing large xlsx" New topic
Author

OutofMemory Exception while parsing large xlsx

Sairam Pareek
Greenhorn

Joined: Nov 27, 2012
Posts: 2
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
Marshal

Joined: Mar 22, 2005
Posts: 42648
    
  65
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.


Ping & DNS - my free Android networking tools app
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Welcome to JavaRanch Sairam Pareek
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1824
    
    7

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.


Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Sairam Pareek
Greenhorn

Joined: Nov 27, 2012
Posts: 2
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/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: OutofMemory Exception while parsing large xlsx