I'm using ExcelWriter (SAExcel.dll version 1.1.0.0) in Classic ASP (I know it's an ancient configuration) to generate some pretty hefty reports (~12,000 rows of 50 cells at the most). When generating the reports, the process's memory usage spikes by a little over 100mb but when the report is complete it never returns back to its prior usage level. Typically 10-15mb (But sometimes up to 50mb!) is left occupied in memory and as the reports are generated this accumulates and eventually causes an error to occur and prevent any new reports from being generated.
Here's the error:
Microsoft VBScript runtime error '800a01fb' An exception occurred: 'xlw.Save'
/report.asp, line 2947
Sometimes the error is a different one of a similar format but also contains:
not enough storage is available
Here's my code to initialize the ExcelWriter:
Function RunExport()
'--- Create spreadsheet
Set xlw = Server.CreateObject("Softartisans.ExcelWriter")
Set cells = xlw.Worksheets(1).Cells
The 'cells' object is filled with data from a number of recordsets and styled with a collection of Style and Font objects created like this:
set NumStyleNormal = xlw.CreateStyle
set ReportFont2 = xlw.CreateFont
Here's the code that is supposed to clear out the objects in memory and send the report to the browser after the cells have been populated:
err.clear
'--- Save Spreadsheet File
xlw.Save "report.xls", saOpenInExcel
if err.number > 0 then
response.write err.description
end if
xlw.Close
Set xlw = nothing
Set Cells = nothing
End Function
The code sets all the recordsets and dictionary objects used to 'nothing' right before the save so I don't think that those are causing the leak. Does ExcelWriter create some sort of data in memory that my code / asp garbage collection isn't cleaning up properly?