'OutOfMemoryException' reading 20mb XLSX file
问题 I'm using NPOI to deal with Excel files. Here's how I'm reading files: using (FileStream stream = File.OpenRead(excelFilePath)) { IWorkbook wb = WorkbookFactory.Create(stream); ... } However, for any XLSX file larger than a few megabytes, it causes memory usage to shot up to about 1GB and eventually throw an OOM exception. Doing some research, I've found out that, strangely, loading a workbook from a File rather than a Stream results in less memory consumption by POI. The closest C#