Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all articles
Browse latest Browse all 1877

New Post: Memory problem with ClosedXML

$
0
0
I'm having a similar problem with memory not being de-allocated when the workbook/worksheet are disposed.
I have created a datatable and am creating a workbook/worksheet directly from it:
 Try
            Dim WorkBook As XLWorkbook = New XLWorkbook()
            WorkBook.CalculateMode = XLCalculateMode.Manual
            Dim WorkSheet As IXLWorksheet = WorkBook.Worksheets.Add(SheetName)
            WorkSheet.Cell(1, 1).InsertTable(Datatbl.AsEnumerable())            'insert the entire datatable
            WorkBook.SaveAs(XLSPathFileName)
            WorkSheet.Dispose()
            WorkBook.Dispose()
        Catch ex As Exception
            LOG("CreateXLS error: " & ex.Message)
        End Try
After this has completed, the workbook/worksheet look great but it leaves me with over 150 MB of allocated memory when the application usually has about 15MB prior to workbook creation. I also dispose the datatable right afterwards as well.
Any advice on how I can release this memory?
Thanks,
Rusty

Viewing all articles
Browse latest Browse all 1877

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>