나는이 답변을 알고 있지만 맹세코 잊었습니다.많은 이미지가로드되면 메모리가 부족합니다.
이 기능이 있습니다. 비트 맵을로드하고 그립니다. 그것은 연속적으로 빠르게 호출 될 수 있습니다. 300 비트 정도가 지난 후에 System.OutOfMemoryException으로 응용 프로그램이 충돌합니다.
private void PaintPicture()
{
string FullPath = Global.RunttimePath + EditType.FilePath;
if (File.Exists(FullPath))
{
Image i = Image.FromFile(FullPath);
//DrawImage(i, pnlPicture, pbColor.BackColor); //I disabled this so the problem is not here
i.Dispose();
//GC.Collect(); //I know I know... I should never call GC. So disabled it :)
}
else
{
//DrawImage(Properties.Resources.Fail800, pnlPicture, Color.White, true);
}
}
을 당신은 당신의 예제 코드에서 아무런 일도하지 않았다. 문제의 원인은 다른 곳에 있으며이 코드는 단지 "St 원래 낙타를 부러 뜨 렸습니다. "또는 문제는 여기에 질문을 게시하기 위해 제거한 코드에 있습니다. –
이미지는 GDI 리소스이며 어쨌든 GC가 없습니다. – TaW