我已经在这个一对夫妇的时候,不能弄明白。 DrawPath方法抛出System.OutOfMemoryException。DrawPath(笔,GraphisPath)抛出OutOfMemoryException异常
我看到pen.DashPattern实际上也在抛出System.OutOfMemoryException,所以我设置了破折号模式,但纠正了这种错误并没有防止错误。
using (var pen = new Pen(Color.Black,1.0f))
{
pen.DashPattern = new[]{1.0f};
pen.Transform = context.ReverseTransform;
try
{
using (var temporaryPath = new GraphicsPath(path.PathPoints, path.PathTypes))
{
context.Graphics.DrawPath(pen, temporaryPath);
}
}
}
在这里的任何帮助将是可爱的!提前致谢!
你的path.PathPoints数组有多大? – Tigran
PathPoints 0和几百... – Diogo
之间变化看代码的,你的性反应,我会说,真正的问题不在这里。可以使用一些内存分析器像埃德建议,或者只是http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx useProcessExploer。运行您的程序并使用它,当前查看Process Explorer中可见的WorkingSet找出UX故障的路径。如果你在32位机器上,如果工作集到达arrounf 1.2GB的mem空间进程将导致memoverflow异常。 – Tigran