This project has moved and is read-only. For the latest updates, please go here.

Excessive memory consumption on SaveAs()

Mar 14, 2014 at 12:11 PM
Hello , I need to export the result of a sql query on an Excel spreadsheet and to do this I use this library. Unfortunately I seem to have found (thanks to a memory profiler) an abnormal consumption of memory.
I considered a query of 30000 rows and 30 columns that products an excel sheet of 4.5 MB. After generating the workbook (but not saved) the memory is increased of 123 MB of which 93 MB for objects which belong to the library ClosedXML and 30 MB for objects such as strings, datetime and numbers. Saving this file on disk (istruction .SaveAs (filename) ) there is a considerable spike in memory (about 4 times the size of worbook, but it is not linear) and then invoking the garbage collector is released. Is it possible doing somehow for limit this peak and avoid an ​​Out-of -memory error?
Thanks, Simona