You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is probably due to random allocation of additional memory. Try setting the initial size of the outputMemoryStream to something close to what the final size ought to be.
It could also be because of how the decompression is attempted inside SharpZipLib, in that case I would suggest trying "Store" instead of Deflation compression, as PDFs usually doesn't compress that well anyway (really depends on the content though).
Another thing you could try is to write the files to a temporary folder before compressing them. If the compression is done in a separate loop, chances are that the memory allocated for the decryption could all be freed by the GC, allowing the compression to allocate the necessary memory chunks.
Probably pretty trivial, but maybe try writing the decryptedPaper byte array straight into the output stream instead of creating temporary memory streams and buffers inside the loop?
Steps to reproduce
Expected behavior
Create a zip file and return the result as a byte[]
Actual behavior
Throw OutOfMemoryException
Version of SharpZipLib
ICSharpCode.SharpZipLib 0.85.4.369
Obtained from (only keep the relevant lines)
The text was updated successfully, but these errors were encountered: