[英]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 . 我有XLSM格式的Macro Enabled Excel文件 。 Inside this excel, 2-3 dependent dropdowns are there. 在此excel内部,有2-3个依赖的下拉菜单。 I have written a macro code to stop delete for a particular column. 我已经编写了一个宏代码来停止删除特定列。
I am uploading this excel using the following code. 我正在使用以下代码上传此excel。
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. java.lang.OutOfMemoryError:超出了GC开销限制:当GC无法连续释放对象时,将出现此错误。 You can specify the limit in vm startup arguments. 您可以在虚拟机启动参数中指定限制。
This means with Macro on your references beocme strong and are not eligible for GC . 这意味着在您的引用上使用Macro会变得非常强大,并且不符合使用GC的资格。 The same objects in the absence of Macro are eligible for GC. 缺少Macro的相同对象有资格使用GC。
You need to look into as why on addding Macro , references are becoming reachable. 您需要研究一下为什么在添加Macro时引用变得可访问。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.