OutOfMemoryException: export to spreadsheet with SAX approach

Home Forums Open-Xml-Sdk OutOfMemoryException: export to spreadsheet with SAX approach

This topic contains 2 replies, has 2 voices, and was last updated by  Krzysztof D. 8 years, 5 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #3440

    Krzysztof D.
    Participant

    Hi,

    I was implementing export of large amount of data to spreadsheet.
    Unfortunately I think there is a bug in 2.6 version, OpenXmlWriter throws OutOfMemoryException when exporting large amount of data (process memory was increasing up to ~200MB and then writer thrown exception), from stacktrace I could see it was from thrown by MemoryStream from OpenXmlWriter.

    after switching to 2.5 it is working fine (I cold export 1M rows)
    regards.

    Krzysztof

    #3441

    Eric White
    Keymaster

    Hi Krzysztof,

    There are lots of factors that can impact memory usage. Also OutOfMemoryException sometimes does not mean that the program is out of memory – it can mean that the memory is too fragmented to allocate the desired amount of memory.

    The first thing that I recommend that you do is to build in 64-bit mode. I have encountered situations where the Open-Xml-Sdk ran out of memory in 32-bit mode, but did not in 64-bit mode.

    Certainly, the memory usage profile for 2.6 will be different from 2.5. Version 2.6 is based on System.IO.Compression, which will alter the pattern of memory usage. Version 2.5 was based on a weird, internal implementation of the ZIP file format, and I don’t know the details of the impact of these two libraries on memory usage. I am not surprised that they are different.

    Unfortunately, I have been pulled from that project. I am no longer maintaining the Open-Xml-Sdk.

    I suggest that you try with 64 bit mode. If that does not fix your issue, then I suggest that you create an issue on GitHub for this.

    Cheers, Eric

    #3446

    Krzysztof D.
    Participant

    Hi Eric,

    yep, it’s thrown from the IO* module, not directly from OpenXML – just treated it as a whole.
    will give a try in free time to check it again.
    thank you for info and suggestions.

    Cheers,
    Krzysztof

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.