Free Support Forum - groupdocs.com

V17.2.0 reports OutOfMemory with excel file

Hi,


Viewer v17.2.0
java version “1.8.0_112” / Java™ SE Runtime Environment (build 1.8.0_112-b15) / Java HotSpot™ 64-Bit Server VM (build 25.112-b15, mixed mode)

I use my codes to test excel file but got below error:
Exception in thread “main” java.lang.OutOfMemoryError: Java heap space
at java.awt.image.DataBufferInt.(DataBufferInt.java:75)
at java.awt.image.Raster.createPackedRaster(Raster.java:467)
at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1032)
at java.awt.image.BufferedImage.(BufferedImage.java:333)
at com.groupdocs.viewer.internal.c.a.c.b.a.b.a.(Unknown Source)
at com.groupdocs.viewer.internal.c.a.c.a.d.af.Y(Unknown Source)
at com.groupdocs.viewer.internal.c.a.c.FJ.a(Unknown Source)
at com.groupdocs.viewer.internal.c.a.c.FJ.a(Unknown Source)
at com.groupdocs.viewer.internal.c.a.c.dO.toImage(Unknown Source)
at com.groupdocs.viewer.converter.c.b.a(Unknown Source)
at com.groupdocs.viewer.converter.c.b.a(Unknown Source)
at com.groupdocs.viewer.converter.c.b.a(Unknown Source)
at com.groupdocs.viewer.converter.a.b(Unknown Source)
at com.groupdocs.viewer.converter.a.CB(Unknown Source)
at com.groupdocs.viewer.converter.c.g.bEC(Unknown Source)
at com.groupdocs.viewer.converter.a.bEE(Unknown Source)
at com.groupdocs.viewer.handler.ViewerHandler.a(Unknown Source)
at com.groupdocs.viewer.handler.ViewerHandler.a(Unknown Source)
at com.groupdocs.viewer.handler.ViewerImageHandler.a(Unknown Source)
at com.groupdocs.viewer.handler.ViewerImageHandler.getPages(Unknown Source)
at docviewer.DocViewerTest.main(DocViewerTest.java:51)

I set Xms4096m because Windows Task Manager said there still have available 7G RAM, but I still got OOM.
Related files are attached for your reference.

Is my setting wrong or any comments?

Thank you.

@andersonlin,


Thanks for sharing the concerned files.
This issue is reproduced at our end as well. Hence, we’ve logged it in our internal issue tracking system with ID:VIEWERJAVA-1391. As we get any update from the concerned team, we’ll apprise you.

We’ll appreciate your patience.
Many Thanks

@andersonlin,


Exception in thread “main” java.lang.OutOfMemoryError: Java heap space
at java.awt.image.DataBufferInt.(DataBufferInt.java:75)
at java.awt.image.Raster.createPackedRaster(Raster.java:467)
We got a solution from the concerned team to render such excel sheets. It appears because you are trying to render worksheet with more than 65K rows in it. In such cases, we’d recommend you to render worksheets partially. You may follow the code given below:

ImageOptions imageOptions = new ImageOptions();
imageOptions.getCellsOptions().setOnePagePerSheet(false);
imageOptions.getCellsOptions().setCountRowsPerPage(50);
// Get pages
List pages = imageHandler.getPages(guid, imageOptions);

<span style=“font-family: “Times New Roman”; white-space: normal;”>Please try this way and share your feedback. 
<span style=“font-family: “Times New Roman”; white-space: normal;”>Best wishes

Hi, Atir:


Your workaround suggestion solved this problem.
Thank you very much.

@andersonlin,


We are always here to help you out.