When loading a workbook, it is hard to predict how large the final in-memory model will be.
Note that we are already using
MemorySetting.MEMORY_PREFERENCE, as well as loading specific sheet(s) only (
Sometimes, users of our product try to process very large workbooks (100MB or more), and we run the risk of running out of memory, and destabilizing the server. However, not all sheets are “large”, so we don’t want to restrict usage of our product only by file size.
It would be nice to have an event listener that can be registered during workbook loading, to keep track of how much content has been loaded so far, and optionally abort the load process. I’m thinking about something similar to
com.aspose.cells.AbstractCalculationMonitor#beforeCalculate(). If the total number of cells loaded having real content exceeds a limit (100.000? 1.000.000?), I’d like to proactively abort the load process with an exception, rather than consuming all the heap of the server.
I hope the problem description is clear. Let me know if you have any questions, or a proposal for an API for this.