OutOfMemoryError: Chart.toImage

Hi,

I have experienced this problem:
I'm using latest Aspose.Cells 7

java.lang.OutOfMemoryError: GC overhead limit exceeded
at java.lang.Double.valueOf(Unknown Source)
at com.aspose.cells.bk.a(Unknown Source)
at com.aspose.cells.bk.a(Unknown Source)
at com.aspose.cells.bm.a(Unknown Source)
at com.aspose.cells.bm.b(Unknown Source)
at com.aspose.cells.bX.ai(Unknown Source)
at com.aspose.cells.v.s(Unknown Source)
at com.aspose.cells.v.o(Unknown Source)
at com.aspose.cells.cb.a(Unknown Source)
at com.aspose.cells.Chart.toImage(Unknown Source)

What could be the reason?

I'm making Excel with All type of Column charts.


Seems like belong to specific chart type:

in aspose terminlogy:
number=17.

com.aspose.cells.ChartType.COLUMN_3_D

Hi,


Please try the new fix: v7.0.2.4

If you still find the issue,let us know with sample code and template file(s).



Thank you.

Hi Amjad,


I’m not sure that installation of new library can help.
It is hard to get code, I can make scren dump of object properties in debug mode.
But I will try to find more inforamtion.

In general I’m generating chart via Aspose.Cells , then converting it to image in order to insert into Word, and I have got OutOfMemory during Chart.toImage()

But it’s important that I do it for this chart:
com.aspose.cells.ChartType.COLUMN_3_D

Hi,

If issue is of chart.toImage(), we think you can save the workbook as an excel file first and then send the file to us. We will test the memory issue by converting charts in the excel file to images.

Thank you.

Hi,


I have attached excel file.
Thank you for help.


Hi,


I tested and converted some of the charts in your template file (e.g first, second, third, fourth etc.) to Image files, it works fine. I am using latest fix: v7.0.2.5, please try it. I am using the following sample code:

Workbook book = new Workbook(“file.xlsx”);
Worksheet sheet = book.getWorksheets().get(“Report”);
Chart chart = sheet.getCharts().get(idx);
ImageOrPrintOptions imgOpts = new ImageOrPrintOptions();
imgOpts.setImageFormat(ImageFormat.getPng());
chart.toImage(“outChart.png”, imgOpts);

If you still find the issue, kindly give us complete runnable sample code to reproduce the issue on our end.

Thank you.

Hi Amjad,


Thank you for your attempt.
But I’m yes still expreinece problem.

I’m no sure how I can give your a code, because it is working under JBoss,
with huge chain of classes.

Hi,

Would you please try to open the same excel file in your JBoss environment and convert charts in it to images? If you can convert it to images successfully too, we think the issue maybe related with other parts of your program and we need your sample project or code to reproduce the issue.

Thank you.

Hi!

I have found reason of a bug: if set MajorUnit property of a value axis to zero, it lead to OutOfMemory exception. I understand, that set major unit to 0 doesn’t have any sense, but, however, it shouldn’t eat all you memory and do application down. See attached code to reproduce the bug. I have tried this code on last Aspose.Cell version, 7.0.3, but it still doesn’t works.

Hi,

Thanks for sharing us the sample code with details.

Yes, the major units must be greater than zero. In the next official release, we will handle this case by throwing an argument exception accordingly.


Thank you.