gpt4 book ai didi

c# - LeadTools MaximumGlobalRasterImageMemory

转载 作者:太空宇宙 更新时间:2023-11-03 21:03:16 27 4
gpt4 key购买 nike

在我的 Web 应用程序中,我使用 LeadTools 从流创建多页 Tiff 文件。下面的代码展示了我如何使用 leadtools。

using (RasterCodecs codecs = new RasterCodecs())
{
RasterImage ImageToAppened = default(RasterImage);
RasterImage imageSrc = default(RasterImage);
codecs.Options.Load.AllPages = true;
ImageToAppened = codecs.Load(fullInputPath, 1);
FileInfo fileInfooutputTiff = new FileInfo(fullOutputPath);
if (fileInfooutputTiff.Exists)
{
imageSrc = codecs.Load(fullOutputPath);
imageSrc.AddPage(ImageToAppened);
codecs.Save(imageSrc, fullOutputPath, RasterImageFormat.Ccitt, 1);
}
else
{
codecs.Save(ImageToAppened, fullOutputPath, RasterImageFormat.Ccitt, 1);
}
}

以上代码工作正常,我的 Web 应用程序收到了大约 2000 个请求的许多请求。在某些情况下,我得到以下错误。但后来它再次适用于其他请求。

You have exceeded the amount of memory allowed for RasterImage allocations.See RasterDefaults::MemoryThreshold::MaximumGlobalRasterImageMemory.

内存问题是针对单个请求还是针对应用程序启动期间的所有对象(全局对象)?那么上述错误的解决方案是什么?

最佳答案

您报告的错误引用了MaximumGlobalRasterImageMemory:

You have exceeded the amount of memory allowed for RasterImage allocations.See RasterDefaults::MemoryThreshold::MaximumGlobalRasterImageMemory.

documentation它指出:

Gets or sets a value that specifies the maximum size allowed for all RasterImage object allocations.

When allocating a new RasterImage object, if the new allocation causes the total memory used by all allocated RasterImage objects to exceed the value of MaximumGlobalRasterImageMemory, then the allocation will throw an exception.

所以看起来它适用于所有对象。

这些是指定的默认值:

On x86 systems, this property defaults to 1.5 GB.

On x64 systems, this property defaults to either 1.5 GB or 75 percent of the system's total physical RAM, whichever is larger.

我建议您熟悉 SDK 的文档。

关于c# - LeadTools MaximumGlobalRasterImageMemory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43227037/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com