[
  {
    "Id": "625481",
    "ThreadId": "260795",
    "Html": "\r\n<p>I have used this great zip dll for a while in my projects, however an issue has started appearing over the last few days I am unable to fix. An application i wrote zips up files and downloads them via ASP.NET using the code at the bottom of the post. There\r\n seems to be an error when I add other .zip files into my Ionic.Zip object, and causes a System.OutOfMemoryException. I've tried adding changing the compression level and setting the parallel defalte option as suggested in other posts but this doesn't work\r\n either. The zip files I am downloading are between 150 - 400MB (total 1.3GB), I've tried selecting only 2 of the smallest which had a total file size of 330MB and although this didn't give any exceptions it didn't appear to do anything, the browser tab keep\r\n processing for 2 hours until I closed the tab without actually starting a download (I'm using firefox and the little processing icon kept spinning).</p>\r\n<p>&nbsp;</p>\r\n<p></p>\r\n<div style=\"color:black; background-color:white\">\r\n<pre><span style=\"color:blue\">protected</span> <span style=\"color:blue\">void</span> StreamFilesIntoZipFile(<span style=\"color:blue\">string</span> zipFileName, List&lt;<span style=\"color:blue\">string</span>&gt; filePaths) {\r\n            <span style=\"color:blue\">string</span> displayFilename = HttpUtility.UrlPathEncode(zipFileName);\r\n            Response.AddHeader(<span style=\"color:#a31515\">&quot;Content-disposition&quot;</span>, <span style=\"color:#a31515\">&quot;attachment; filename=&quot;</span> &#43; displayFilename);\r\n            Response.ContentType = <span style=\"color:#a31515\">&quot;application/zip&quot;</span>;\r\n\r\n            <span style=\"color:blue\">using</span> (Ionic.Zip.ZipFile zipFile = <span style=\"color:blue\">new</span> Ionic.Zip.ZipFile()) {\r\n                zipFile.CompressionLevel = Ionic.Zlib.CompressionLevel.BestSpeed;\r\n                zipFile.ParallelDeflateThreshold = -1;\r\n                <span style=\"color:green\">//Ionic.Zip.ZipFile zipFile = new Ionic.Zip.ZipFile();</span>\r\n                <span style=\"color:blue\">foreach</span> (<span style=\"color:blue\">string</span> filePath <span style=\"color:blue\">in</span> filePaths) {\r\n                    zipFile.AddFile(filePath, <span style=\"color:#a31515\">&quot;&quot;</span>);\r\n                }\r\n                zipFile.Save(Response.OutputStream);\r\n            }\r\n            <span style=\"color:green\">//Response.Close();</span>\r\n\r\n        }\r\n</pre>\r\n</div>\r\n<p></p>\r\n",
    "PostedDate": "2011-06-09T09:06:43.593-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "625623",
    "ThreadId": "260795",
    "Html": "<p>I am a new user to this library and have also noticed something similar. I am processing a large number of zip files.. and even though I discard that object, it appears as though the application doesn't release the memory. Could there be a memory leak in this release? Over time, I will too receive an OutOfMemoryException because I never regain the RAM from discarded ZipFile objects.</p>",
    "PostedDate": "2011-06-09T13:42:47.097-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "629480",
    "ThreadId": "260795",
    "Html": "<p>I suppose the OutOfMemory problem is occurring because by default ASPNET buffers all the output before sending the first byte.&nbsp; This means if you zip a 1.3gb file, ASPNET tries to hold the compressed version of that thing into a memory buffer.&nbsp;</p>\r\n<p>I know of two good ways to avoid this:</p>\r\n<p>- turn off response buffering.&nbsp; See here: <a href=\"http://stackoverflow.com/questions/2277704/enable-chunked-transfer-encoding-in-asp-net/2277764#2277764\">http://stackoverflow.com/questions/2277704/enable-chunked-transfer-encoding-in-asp-net/2277764#2277764</a></p>\r\n<p>- save to a filesystem file, then send that file down to the client.</p>\r\n<p>&nbsp;</p>\r\n<p>Good luck.</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2011-06-17T23:10:37.927-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "822059",
    "ThreadId": "260795",
    "Html": "<p>I have exactly the same problem as nullvalue. When I create a large number of zip files, the application memory just grow until I get an OutOfMemoryException.</p>\r\n<p>Any solution or workaround to this issue?</p>",
    "PostedDate": "2012-04-10T10:25:21.783-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]