Archived Forum Post

Index of archived forum posts

Question:

What is the Max Size does Zip.WriteToMemory supports?

Mar 13 '13 at 11:58

Hi,

I am using Chilkat.NET 4 Trail Version.

I am trying to zip PDF's from a Directory and Write it to memory stream by calling Zip.WriteToMemory(). If the size of all PDF's were 420 MB, then zip's to around 350 MB successfully writes to memory. But if I add some PDF's in that directory and increasing the size to 600 MB, then Zip.WriteToMemory() returns 0 bytes.

        string filePath = @"<local path>";
        string[] fileList = Directory.GetFiles(filePath, "*.pdf");
        Chilkat.Zip zip = new Chilkat.Zip();
        zip.UnlockComponent("30-day trial");
        zip.NewZip("Test.zip");
        foreach (string file in fileList)
        {
           zip.AppendFromDir = file;
           Chilkat.ZipEntry entry = zip.GetEntryByName(file);
           if (null != entry)
                 zip.DeleteEntry(entry);
           zip.AppendFiles(file, false);
        }
        byte[] zipBytes = zip.WriteToMemory(); //Returns byte array if the total zipped size is 350MB. If size increased then returning 0 bytes.
        MemoryStream str = new MemoryStream(zipBytes);

Please help.

Thanks.


Answer

WriteToMemory supports zips up to 4GB in size (32-bit). However, Chilkat Zip automatically supports Zip64 when writing to files. In other words, there is basically no limitation to the size of a zip when writing to a file.

If WriteToMemory returns 0 bytes, then examine the LastErrorText.


Answer

Hi,

Thanks for your quick reply.

I have examined the LastErrorText which displayed Out of Memory exception.

I have system with 4 GB RAM and I am trying to zip.WriteToMemory with 2GB data, but still out of memory exception being thrown.

Please advice.

Thanks,