0

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?

4

1 回答 1

0

看起来您并没有遗漏任何垃圾收集,但是我为 SoftArtisans(生产 ExcelWriter 的公司)工作,根据我们的错误跟踪,我们确实修复了 v2 和 v3 中的内存泄漏。不幸的是,这些版本几乎可以投票并且不再可用(我们已经 8 岁了)。如果您有任何问题,请随时离线联系我们:http ://www.officewriter.com/contact-softartisans.aspx

于 2013-09-06T14:11:26.483 回答