我有一个C#编程的应用程序,在使用sharp develop 4.2.1的调试器运行大约13天后,应用程序抛出OutOfMemoryException。
我很困惑,因为异常堆栈跟踪来自急剧发展。这是一个问题还是只是误导?
过去我也没有内存异常,但是每次堆栈跟踪都会显示我的项目的一些代码,而不是急剧的开发。我使用ANTS内存分析器解决了这些问题。
你有什么想法吗? 对于运行应用程序的较长时间,“release”构建是否没有调试器运行更稳定?
非常感谢提前。
-------------------------------------------------------------
Complete Stacktrace:
SharpDevelop Version : 4.2.1.8805-9345aa7c
.NET Version : 4.0.30319.1
OS Version : Microsoft Windows NT 6.1.7601 Service Pack 1
Current culture : Japanese (Japan) (ja-JP)
Current UI language : en
Working Set Memory : 1017236kb
GC Heap Memory : 713962kb
Exception thrown:
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.Collections.Generic.List`1.set_Capacity(Int32 value)
at System.Collections.Generic.List`1.EnsureCapacity(Int32 min)
at System.Collections.Generic.List`1.Add(T item)
at Debugger.Interop.TrackedComObjects.Track(Object obj)
at Debugger.Interop.TrackedComObjects.ProcessOutParameter(Object parameter)
at Debugger.ManagedCallbackSwitch.GetProcessCallbackInterface(String name, ICorDebugAppDomain pAppDomain)
at Debugger.ManagedCallbackProxy.<>c__DisplayClass58.<Exception>b__57()
at Debugger.MTA2STA.<>c__DisplayClass4.<EnqueueCall>b__1()
at Debugger.MTA2STA.PerformCall()
at Debugger.MTA2STA.PerformAllCalls()
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
---- Recent log messages:
09:37:15.383 [1] DEBUG - Debugger: Callback: Exception
09:37:15.383 [1] DEBUG - Debugger: Process has queued callbacks
09:37:15.384 [1] DEBUG - Debugger: Callback: Exception2 (type=DEBUG_EXCEPTION_FIRST_CHANCE)
09:37:15.391 [1] DEBUG - Debugger: Callback: Exception2 (type=DEBUG_EXCEPTION_USER_FIRST_CHANCE)
09:37:15.391 [1] DEBUG - Debugger: Process has queued callbacks
09:37:15.391 [1] DEBUG - Debugger: Callback: Exception2 (type=DEBUG_EXCEPTION_USER_FIRST_CHANCE)
09:37:15.392 [1] DEBUG - Debugger: Process has queued callbacks
09:37:15.392 [1] DEBUG - Debugger: Callback: Exception2 (type=DEBUG_EXCEPTION_USER_FIRST_CHANCE)
09:37:15.396 [1] DEBUG - Debugger: Callback: Exception2 (type=DEBUG_EXCEPTION_USER_FIRST_CHANCE)
09:37:15.397 [1] DEBUG - Debugger: Callback: Exception2 (type=DEBUG_EXCEPTION_CATCH_HANDLER_FOUND)
09:37:15.397 [1] DEBUG - Debugger: Process has queued callbacks
09:37:15.398 [1] DEBUG - Debugger: Callback: Exception2 (type=DEBUG_EXCEPTION_CATCH_HANDLER_FOUND)
09:37:15.398 [1] DEBUG - Debugger: Process has queued callbacks
09:37:15.399 [1] DEBUG - Debugger: Callback: Exception2 (type=DEBUG_EXCEPTION_CATCH_HANDLER_FOUND)
09:37:15.403 [1] DEBUG - Debugger: Callback: Exception2 (type=DEBUG_EXCEPTION_CATCH_HANDLER_FOUND)
09:37:15.405 [1] DEBUG - Debugger: Callback: Exception
09:37:15.405 [1] DEBUG - Debugger: Process has queued callbacks
09:37:15.407 [1] DEBUG - Debugger: Callback: Exception2 (type=DEBUG_EXCEPTION_FIRST_CHANCE)
09:37:15.410 [1] DEBUG - Debugger: Callback: Exception
09:37:15.410 [1] DEBUG - Debugger: Process has queued callbacks
09:37:15.411 [1] DEBUG - Debugger: Callback: Exception2 (type=DEBUG_EXCEPTION_FIRST_CHANCE)
09:37:15.411 [1] DEBUG - Debugger: Process has queued callbacks
09:37:15.411 [1] DEBUG - Debugger: Callback: Exception
09:37:15.411 [1] DEBUG - Debugger: Process has queued callbacks
09:38:13.301 [1] ERROR - ThreadException caught
--> Exception:
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.Collections.Generic.List`1.set_Capacity(Int32 value)
at System.Collections.Generic.List`1.EnsureCapacity(Int32 min)
at System.Collections.Generic.List`1.Add(T item)
at Debugger.Interop.TrackedComObjects.Track(Object obj)
at Debugger.Interop.TrackedComObjects.ProcessOutParameter(Object parameter)
at Debugger.ManagedCallbackSwitch.GetProcessCallbackInterface(String name, ICorDebugAppDomain
pAppDomain)
at Debugger.ManagedCallbackProxy.<>c__DisplayClass58.<Exception>b__57()
at Debugger.MTA2STA.<>c__DisplayClass4.<EnqueueCall>b__1()
at Debugger.MTA2STA.PerformCall()
at Debugger.MTA2STA.PerformAllCalls()
at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code,
CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,
ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback
callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback
callback, Object state)
at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
---- Post-error application state information:
Installed 3rd party AddIns:
Workbench.ActiveContent: <null>
答案 0 :(得分:3)
这是SharpDevelop调试器中的内存泄漏。它维护它使用的任何COM对象的列表,并且在调试会话结束之前不会释放它们。
如果您需要长时间运行程序,则应该在没有调试器的情况下运行它。如有必要,您稍后可以将调试器附加到该过程。