有一个处理大量图像的应用程序。内存占用大约是预期大小的两倍。
我已将我的代码修剪为如下所示,_source 是一个实例变量,它保持在范围内:
int width = 924;
int height = 1116;
int length = width * height;
UInt32[] data = new UInt32[length];
_source = BitmapSource.Create( width, height, 96, 96,
PixelFormats.Pbgra32,
null, data, width * sizeof(UInt32));
_source.Freeze();
如果我通过 ANTS Memory Profiler 提供它,我会看到 BitmapSafeMIHandle 被分配,并且每次运行时,内存使用量的增加大约是位图大小的两倍。
我不做什么?我必须忍受这个吗?任何和所有信息都表示赞赏。
干杯,奈杰尔