在此時,應用程序消耗大約150MB的內存。看看這個:查詢正在使用的內存崩潰應用程序?
異常訊息話題:
類型 'System.OutOfMemoryException的' 引發的異常。
堆棧跟蹤: 在System.Diagnostics.NtProcessInfoHelper.GetProcessInfos() 在System.Diagnostics.ProcessManager.GetProcessInfos(字符串機器名) 在System.Diagnostics.Process.EnsureState(州狀態) 在System.Diagnostics程序。在Streamsink.frmMain.CalculateStatistics()中的C:\ Projects \ Streamsink \ \ VideoPhill \ PlayerRAC \ StreamSink \ StreamSink \ StreamSink \ frmMain.cs:第803行 位於C:\ Projects \ VideoPhill \ PlayerRAC \ StreamSink \ StreamSink \ StreamSink \ frm中的StreamSink.frmMain._timerUI_Tick(Object sender,EventArgs e) Main.cs:行736 在System.Windows.Forms.Timer.OnTick(EventArgs五) 在System.Windows.Forms.Timer.TimerNativeWindow.WndProc(消息&米)
那麼,什麼是錯的這裏?
EDIT(詳細信息):
這一次失敗:
private long MemoryUsed
{
get
{
return Process.GetCurrentProcess().WorkingSet64/1024/1024;
}
}
,距離稱爲:
private void CalculateStatistics()
{
if (InvokeRequired)
{
this.BeginInvoke(new MethodInvoker(CalculateStatistics));
}
else
{
barStaticItem1.Caption = "Mem: " + MemoryUsed.ToString() + " MB";
}
}
是從計時器事件調用,和定時器的類型是: System.Windows.Forms.Timer
。
*錯誤不能自行復制。 *
(因爲我現在正在刪除我的答案,將此評論移至提問處):嗯,看起來有點奇怪。我仍然懷疑計時器可能與它有關。如果你改變它會發生什麼,所以這個調用不是由定時器觸發的? – 2012-04-09 22:17:08
@BrianRasmussen沒有嘗試過,因爲每兩個星期發生一次,只有在生產中。沒有機會故意挑釁它... – 2012-04-10 06:41:19
@DanielMošmondor:請您發佈完整的repro代碼(àla http://www.yoda.arachsys.com/csharp/complete.html)? – 2012-04-10 13:34:34