I have a large dataset (100,000 rows, 33 columns). I am using OpenXML to take this data and write it to Excel using the method explained here Export big amount of data from XLSX - OutOfMemoryException
It appears to store all of the data in memory when creating the Excel file and then write it all at once because of the XMLWriter. Even in the example above without my own data it appears that this using 700MB-1GB before it finally writes the data.
Is there a way to clear the buffer periodically to limit memory usage or does it have to be all in 1 XMLWriter with how OpenXML works