OutOfMemoryException when creating large ZIP file using System.IO.Packaging

有些话、适合烂在心里 提交于 2019-12-05 06:36:32

Calling the Flush method on the Package object in between creating a new package should probably solve the problem as that would cause the memory buffer to be flushed to disk.

I would use the DotNetZip library (http://dotnetzip.codeplex.com/). I've tried several zip libraries (System.IO like you are currently using and also SharpZibLib) and by far the easiest to use is the DotNetZip library.

You'll almost certainly end up with fewer lines of code and I found the memory usage to be very good (had a problem in a virtual machine environment which I reported and a new release fixed it).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!