Domanda

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?

È stato utile?

Soluzione

It doesn't look like you're missing any garbage collection, however I work for SoftArtisans (the company that produces ExcelWriter) and according to our bug tracking, we did fix memory leaks in v2 and v3. Unforunately, those versions are almost old enough to vote and no longer available (we're at 8). Feel free to contact us offline if you have questions: http://www.officewriter.com/contact-softartisans.aspx

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top