ionic.zip running out memory

Nov 24, 2010 at 8:43 AM

Hey all, I am using an applicatrion that has ionic.zip imported into it.
 I am getting errors in the application, to do with the zip utility running out of memory. does anyone know if there is any config data in which could change the virtual memory, and do you know how effective the zipping is? or does it depend on the file?
 
Any help would be greatly appreciated.
 
Ben 

Coordinator
Nov 24, 2010 at 4:29 PM

Yes, try the ZipFile.ParallelDeflateThreshold property. The most common cause of memory problems in DotNetZip is that DNZ creates too many threads when doing parallel deflation.  This feature was added to speed up zipping of large files, but it uses a somewhat naive heuristic for creating threads.  It creates a number of threads proportional to the number of CPUs you have on your machine.  Each thread consumes some non-trivial amount of memory for buffers (64k).  If you have multiple processes, as with an application running on a server, you can get the same effect multipled by the number of concurrent processes.

one way to test this is to set the ParallelDeflateThreshold to -1, which says, never use parallel deflation, and thus, never consume this extra memory.

If this does not correct the memory problem, then get back to me; I don't know what else it could be but we can try to figure it out.

As to your other question, yes, the effectiveness of the compression depends on the data you are compressing. 

Good luck!

 

Nov 25, 2010 at 10:31 AM

Thanks for the reply, I will try it and let you know if it helps.

 

Thanks again!!!

Nov 25, 2010 at 12:47 PM

Any idea how I change this? I have treid and am outputting the value and it consistently says value = 0. 

 

I have tried ParallelDeflateThreshold = -1 and ParallelDeflateThreshold.Set(-1) after removing the declaration which didnt work either.

 

Any ideas???

 

Thanks Ben

Nov 25, 2010 at 1:11 PM

 

Dim mName As Integer
    Public Property ParallelDeflateThreshold() As Integer '(should this be zipFile?)

        Get    

       Return mName  

     End Get      

 Set(ByVal value As Integer)    'or zipFile?

       mName = value    

   End Set 

   End Property

 

 

Is it something along these lines?

Nov 25, 2010 at 1:44 PM

Is it as simple as this?

Dim zip As New ZipFile
        zip.ParallelDeflateThreshold = -1

Coordinator
Nov 25, 2010 at 4:49 PM

yes, it's as simple as that.