This project is read-only.

LZMA2 archive>256 MB exception/error - corrupted file

Sep 14, 2014 at 4:18 PM
Edited Sep 14, 2014 at 4:23 PM

i used code bellow with sevenzipsharp build from source code "" .
            const string 
               cFile7zdll = @"c:\Program Files (x86)\7-Zip\7z.dll",
               cDirectoryTemp = @"d:\Programy\tmp",
               cFileArchiv = @"d:\neco.7z";

            Random random = new Random();
            byte[] buffer = new byte[1024 * 1024];

            for (int file = 0; file < 257; file++) {
                using (FileStream fs = new FileStream(
                    String.Format("{0}\\file_{1:0000}.bin", cDirectoryTemp, file), FileMode.OpenOrCreate)) {
                    fs.Write(buffer, 0, buffer.Length);
            var tmp = new SevenZip.SevenZipCompressor();
            tmp = new SevenZipCompressor();
            tmp.ArchiveFormat = OutArchiveFormat.SevenZip;
            tmp.CompressionMethod = CompressionMethod.Lzma2;
            tmp.CompressionLevel = CompressionLevel.Ultra;
            tmp.Compressing += (s, e) =>
                Console.WriteLine(String.Format("{0}%", e.PercentDone));
            tmp.CompressDirectory(cDirectoryTemp, cFileArchiv);
After several tries I think I found a bug.
For comparing i used bat file with command
"c:\Program Files (x86)\7-Zip\7z.exe" a -m0=lzma2 -mx=9 -t7z test.7z programy\tmp"

7zip 9.20

SevenZipSharp / cause an exception
bat / cause an exception "cant allocate required memory!"

7zip 9.34 alpha

SevenZipSharp / created corrupted file without exception or error in code, with similary files sometimes will cause an exception
bat / works without problem

First view

I' am not sure, but for first look It seems it has something about paging or alocation memory.
With archive file < 256 MB it works withou problem.

Thanks for reply.