且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

获取OutOfMemoryException异常运行时与消息"内存不足,无法继续执行程序和QUOT的执行;

更新时间:2023-01-14 14:21:39

您也许可以尝试让你的程序访问更多的内存,但是这将是一场斗争。对于.NET应用程序的内存量是由你的machine.config文件中processModel / MemoryLimit设置控制。 Microsoft建议您将其设置不高于60%。

You could probably try to allow your program to access more memory, but it would be a struggle. For a .NET application, the amount of memory is controlled by the processModel/memoryLimit setting in your machine.config file. Microsoft recommends that you set it no higher than 60%.

不过,要装载50多MB的图像,全部一次,以显示缩略图(这可能是微小的大小)。我认为,这是您进行更改。你可以加载您的图像一个接一个,然后生成缩略图和释放内存,立竿见影。

However, you are loading 50+ MB images, all at once, to display thumbnails (which are probably tiny in size). I suggest that this is where you make your change. You could load your images one by one, then generate the thumbnail and free the memory straight away.

在任何情况下,具有50 MB +图像是当你试图显示缩略图效率不高。你就不能保存的缩略图,而不是每次都产生呢?

In any case, having 50 MB+ images is not efficient when you are trying to show a thumbnail. Can't you just save the thumbnails and not have to generate them every time?