We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

JavaOut fo memory error


while I am running the java applicatio with 512MB heap ( using java -Xmx256M command) the below error is coming the data file size is nearly 40MB.

JVMST109: Insufficient space in Javaheap to satisfy allocation request

Exception in thread "main" java.lang.OutOfMemoryError

at com.aspose.cells.do.h(Unknown Source)

at com.aspose.cells.do.a(Unknown Source)

at com.aspose.cells.Rows.getRow(Unknown Source)

at com.aspose.cells.Cells.getCell(Unknown Source)

at com.avon.infomanagement.util.pdfutil.ExcelBuilder.addDataCell(ExcelBuilder.java(Compiled Code))

at com.avon.infomanagement.util.pdfutil.ExcelBuilder.drawTabular(ExcelBuilder.java(Compiled Code))

at com.avon.infomanagement.util.pdfutil.ExcelBuilder.drawData(ExcelBuilder.java(Compiled Code))

at com.avon.infomanagement.util.pdfutil.ExcelBuilder.execute(ExcelBuilder.java(Compiled Code))

at com.avon.infomanagement.util.pdfutil.ReportManager.startJobManager(ReportManager.java:159)

at com.avon.infomanagement.util.pdfutil.ReportManager.main(ReportManager.java:65)

Can anyone help us to sovle the outofmemery problem? what could be the best configaration of server for running 40MB size files.


For the OutOfMemory Exception, you have to specify sufficient memory for JVM. Kindly make sure that you have provided and extended the JVM memory appropriately to run your specific program. I have tested and processed a 40MB file with the component extending the memory appropriately and it works fine.

Following is the command line I am using to run my code on the Windows XP command prompt:

java -Xms512m -Xmx512m MyTest

Thank you.

Hi Amjad,

I tried with java -Xms512m -Xmx512m but still am getting the same error , do we have memry leakages or unused objects with aspose api? Because when i check with GC options for every 200 rows the GC is getting filled I mean young generations after 70,000 rows the tenued genaration I mean Fullgc is displaying.

Do we have any row limitaions? what is the memry requirements for running the more than 3 lakh rows ( in each sheet 60,000 rows) ?Please tell me some performance tips to save the workbook in between kind of things.


Satish Madadi


Well, I am not very sure about your memory leakage problem. And there is not any row limitation enforced by Aspose.Cells for Java whatsoever. The row limit is different and enforced by MS Excel versions (97-2003 and 2007). If you use .xls file format, MS Excel 97-2003 would restrict you to 65K rows only where as MS Excel 2007 (.xlsx file format) provides you 1048576 rows. Normally a 5MB file would require 50MB memory (10 times the size of the file).

I have tested your scenario using my sample code below and it works fine without any issue at all. The generated file has 49MB size.

Sample code:

try {
System.out.println("========= file generation start ========");
Workbook workbook = new Workbook();
Worksheets worksheets = workbook.getWorksheets();
Worksheet sheet;
int rowCount = 60000;
Cells cells;
for(int i = 0;i<6;i++)

sheet = worksheets.addSheet();
cells = sheet.getCells();

for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) {
cells.getCell(rowIndex, 0).setValue("Product_" + rowIndex);
cells.getCell(rowIndex, 1).setValue("Category_" + rowIndex);
cells.getCell(rowIndex, 2).setValue("Unit_" + rowIndex);
cells.getCell(rowIndex, 3).setValue("Orders_" + rowIndex);
cells.getCell(rowIndex, 4).setValue("Quotes_" + rowIndex);
cells.getCell(rowIndex, 5).setValue("Tasks_" + rowIndex);
cells.getCell(rowIndex, 6).setValue("RowIndex_" + rowIndex);


workbook.save("e:\\files\\n81015_test_" + rowCount + ".xls");

System.out.println("========= file generation end ========");

} catch (Exception ex) {

Well regarding tips, you may split the data into multiple workbooks preferrably if it suits you but neverthless, if you got sufficient memory there should be no problem in that case.

Could you try the attached version if it makes a difference. I have tried the above code with the attached version and the generated file is about 49MB in size.

And, I use the similar command line to run the code: java -Xms512m -Xmx512m

Thank you.