Closed koraybayram closed 11 years ago
Is it possible for you to attach the xml as a file? If not maybe you could find just a small chunk of it that fails or some binary data that fails. I will try to generate some strings in the 0 - 40 KB range and see if I can reproduce it.
Xml files are generated dynamically from database. So I cannot attach a sample file. But I think, any xml file can be used to test it.
I tried some xml files and still cannot reproduce it. You could just save the string to a file to post to github but maybe the data in the database should not be shared on the internet. Looking closer at your code, it would probably fail if used from multiple threads. Is that possibly the problem? The LZ4 Compressors and Decompressors are not threadsafe and need to be created for each thread or for each time they are used if used by multiple threads. Or you can call the static functions in the LZ4 class. They create and use a new compressor and decompressor on each call.
We used global compressor with multiple threads. we will change our code as compressor(decompressor for each thread. Thanks for your help.
We used LZ4Sharp for xml string - at most 40Kbyte - compression application. It calls compress method about 50 million times. But we got System.AccessViolationException during the execution. There might be some problem about algorithm. Of course, it might be occured according to our usage.
Exception Info: System.AccessViolationException Stack: at LZ4Sharp.LZ4Compressor32.Compress(Byte, Byte, Int32, Int32) at LZ4Sharp.LZ4Compressor32.Compress(Byte[], Byte[]) at LZ4Sharp.LZ4Compressor32.Compress(Byte[]) at Common.XmlCompresser.Compress(System.String)
Our Usage: