I need to write a large excel file in java. I need four different types of data in same excel, as I need to hand over that excel to the customer, making 4 different excels don't suit me. So I went with preparing 4 different sheets each for one type of data. Now data I am fetching from the data base is much larger, and can easily exceed 1048576 rows limit per sheet. So I have handled that overflow part too. Now I was testing this file creation for maximum threshold i.e preparing 4 sheets all having 1048576 rows, and I got java heap exception, I increased memory from 256mb to 2gb and I got the new error that is "GC overhead limit exceeded". I further increased memory to 10GB but got the same error. I agree that I am creating many objects, i.e row.createCell() each time to create a cell of excel. Below is the output I got when I checked memory configurations by free -g :
Memort type   total       used       free     shared    buffers     cached
Mem:            31         22          8          0          0         17
-/+ buffers/cache:          4         27
Swap:            0          0          0
Completely clueless what to do next. CSV file I guess is not an option for me. Any lead will be heartily appreciated.
