离子拉链抛出内存异常 [英] Ionic zip throws out of memory exception

查看:168
本文介绍了离子拉链抛出内存异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用离子拉链(版本1.9.1.8)压缩某些files..I通常有较大的文件总结到2到3 GB ...这个离子拉链作品在我的系统很好,但是当我用它在另一个用户机(现场)......这离子拉链抛出一个异常,同时作为系统的follows.The配置相同。

I use ionic zip (version-1.9.1.8) to compress some files..I usually have large files summing to 2 to 3 GB ...this ionic zip works fine in my system but while i use it in another user machine(ONSITE)...this ionic zip throws an exception as follows.The configuration of both the system are same.

Exception details:
******************
[6/11/2012 01:21:38:812]
 System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at Ionic.Zip.ZipEntry._WriteEntryData(Stream s)
   at Ionic.Zip.ZipEntry.Write(Stream s)
   at Ionic.Zip.ZipFile.Save()
   at Ionic.Zip.ZipFile.Save(String fileName)
   at MyCode.SaveZipFile()

[6/11/2012 01:21:38:828]

System.NullReferenceException: Object reference not set to an instance of an object.
   at Ionic.Zlib.ParallelDeflateOutputStream._Flush(Boolean lastInput)
   at Ionic.Zlib.ParallelDeflateOutputStream.Close()
   at Ionic.Zlib.ParallelDeflateOutputStream.Dispose()
   at Ionic.Zip.ZipFile.Dispose(Boolean disposeManagedResources)
   at Ionic.Zip.ZipFile.Dispose()
   at Mycode.SaveZipFile()
   at Mycode.SaveLogs()

有人能帮助我找到这些问题的原因??

Could someone help me to find the cause of such issues..??

在此先感谢

推荐答案

您需要显示的代码。如果您的应用荏苒到MemoryStream,这将是容易受到内存不足的条件。这将是您的应用程序有问题,没有在库中。

You need to show the code. If your app is zipping into a memorystream, it will be susceptible to out-of-memory conditions. This would be a problem in your app, not in the library.

此外 - 我从堆栈跟踪看到它是使用并行deflater。该交易运行时内存。如果你有内存问题,您可以禁用并行压缩,并使用更少的内存。

Also - I see from the stacktrace that it is using the parallel deflater. This trades runtime for memory. IF you have memory issues, you can disable parallel compression, and use much less memory.

通过这样的事情在你的代码来实现:

Do this by something like this in your code:

 zip.ParallelDeflateThreshold = -1;



也看到此功能的文档:
http://cheeso.members.winisp.net/DotNetZipHelp/html/0988edb5-1d59- 2875-8e77-ad195601cbce.htm

这篇关于离子拉链抛出内存异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆