我已經在這個一對夫婦的時候,不能弄明白。 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