简体   繁体   中英

java.lang.OutOfMemoryError: GC overhead limit exceeded Error while Reading Macro enabled excel sheet through Apache POI

I have a Macro Enabled Excel file in XLSM format . Inside this excel, 2-3 dependent dropdowns are there. I have written a macro code to stop delete for a particular column.

I am uploading this excel using the following code.

 XSSFWorkbook workbook = new XSSFWorkbook(new FileInputStream(fileName)); XSSFSheet sheet = workbook.getSheetAt(1); XSSFRow row; XSSFCell cell; int rows = sheet.getPhysicalNumberOfRows(); 

But it is giving a ERROR:

 java.lang.OutOfMemoryError: GC overhead limit exceeded com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.getNodeObject (DeferredDocumentImpl.java:972) com.sun.org.apache.xerces.internal.dom.DeferredElementNSImpl.synchronizeD ata(DeferredElementNSImpl.java:126) com.sun.org.apache.xerces.internal.dom.ElementNSImpl.getNamespaceURI(Elem entNSImpl.java:250) 

While Uploading without macro, there is no error and working fine.

java.lang.OutOfMemoryError: GC overhead limit exceeded : This error comes when GC is unable to freeup objects in continuous cycles. You can specify the limit in vm startup arguments.

This means with Macro on your references beocme strong and are not eligible for GC . The same objects in the absence of Macro are eligible for GC.

You need to look into as why on addding Macro , references are becoming reachable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM