{"action":"opened","issue":{"url":"https://api.github.com/repos/alibaba/easyexcel/issues/169","repository_url":"https://api.github.com/repos/alibaba/easyexcel","labels_url":"https://api.github.com/repos/alibaba/easyexcel/issues/169/labels{/name}","comments_url":"https://api.github.com/repos/alibaba/easyexcel/issues/169/comments","events_url":"https://api.github.com/repos/alibaba/easyexcel/issues/169/events","html_url":"https://github.com/alibaba/easyexcel/issues/169","id":390975135,"node_id":"MDU6SXNzdWUzOTA5NzUxMzU=","number":169,"title":"读取100W条记录的Excel出现OOM(1.1.2-beta4版本)","user":{"login":"tangliwang","id":28701025,"node_id":"MDQ6VXNlcjI4NzAxMDI1","avatar_url":"https://avatars2.githubusercontent.com/u/28701025?v=4","gravatar_id":"","url":"https://api.github.com/users/tangliwang","html_url":"https://github.com/tangliwang","followers_url":"https://api.github.com/users/tangliwang/followers","following_url":"https://api.github.com/users/tangliwang/following{/other_user}","gists_url":"https://api.github.com/users/tangliwang/gists{/gist_id}","starred_url":"https://api.github.com/users/tangliwang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tangliwang/subscriptions","organizations_url":"https://api.github.com/users/tangliwang/orgs","repos_url":"https://api.github.com/users/tangliwang/repos","events_url":"https://api.github.com/users/tangliwang/events{/privacy}","received_events_url":"https://api.github.com/users/tangliwang/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-12-14T05:51:23Z","updated_at":"2018-12-14T05:51:23Z","closed_at":null,"author_association":"NONE","body":"初步分析了一下，大概是因为POI底层OPCPackage.open方法有多个重载，easyExcel中使用的是OPCPackage open(InputStream in)；跟读后发现有如下代码：\r\nbyte[] buffer = new byte[4096];\r\nint read = 0;\r\nwhile( (read = inp.read(buffer)) != -1 ) {\r\n      baos.write(buffer, 0, read);\r\n}\r\n判断应该是由于这个问题导致OOM，修改为使用OPCPackage open(File file)或OPCPackage open(String path)可以正常解析。\r\n\r\n附上异常信息：\r\nException in thread \"main\" java.lang.OutOfMemoryError: Java heap space\r\n\tat java.util.Arrays.copyOf(Arrays.java:3236)\r\n\tat java.io.ByteArrayOutputStream.toByteArray(ByteArrayOutputStream.java:191)\r\n\tat org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource$FakeZipEntry.<init>(ZipInputStreamZipEntrySource.java:136)\r\n\tat org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource.<init>(ZipInputStreamZipEntrySource.java:56)\r\n\tat org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:100)\r\n\tat org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:324)\r\n\tat com.alibaba.excel.analysis.v07.XlsxSaxAnalyser.<init>(XlsxSaxAnalyser.java:44)\r\n\tat com.alibaba.excel.analysis.ExcelAnalyserImpl.getSaxAnalyser(ExcelAnalyserImpl.java:47)\r\n\tat com.alibaba.excel.analysis.ExcelAnalyserImpl.analysis(ExcelAnalyserImpl.java:72)\r\n\tat com.alibaba.excel.analysis.ExcelAnalyserImpl.analysis(ExcelAnalyserImpl.java:67)\r\n\tat com.alibaba.excel.ExcelReader.read(ExcelReader.java:112)\r\n\tat easyExcel.ExcelReaderTest.main(ExcelReaderTest.java:25)"}}
{"actor":{"display_login":"tangliwang"}}