我在这个函数中出现内存不足警报,称为500K
时间:
public void DoStuff(string msg)
{
rtfTerminal.Invoke(new EventHandler(delegate
{
rtfTerminal.SelectedText = string.Empty;
rtfTerminal.AppendText(msg);
rtfTerminal.ScrollToCaret();
}));
}
在我声明的全局范围内:
private System.Windows.Forms.RichTextBox rtfTerminal;
- 我想我
new EventHandler
每次打电话都会内存不足,我该如何避免这种情况? - 我因为内存不足而合理
rtfTerminal.AppendText(msg);
吗?