我有过一个DataTable循环,并推动这些进入一些地点,如鼠尾草和SQL表C#应用程序。
虽然它曾经做工精细,莫名其妙地我现在走出一个小时后,内存异常左右运行它。我注意到在任务管理器,通过anbout 1MB的内存使用量上升每一秒,并保持要去!
我的印象是垃圾收集下会采取什么,但可以肯定我保证我使用后丢弃的任何对象。我知道没有代码很难诊断,但有很多呢,我期待更多的一般性建议。
解决方案但可以肯定我保证我使用后丢弃任何物体
的Dispose()没有直接关系内存管理或泄漏。
您将不得不寻找那些仍然到达未使用的对象。使用一个内存分析器找出。
您可以通过免费的 CLR-探查。
I have a C# application that loops through a datatable, and pushes these into some locations such as Sage and a SQL table.
While it used to work fine, I'm inexplicably now getting Out of Memory exceptions after an hour or so of running it. I've noticed in the task manager, the memory usage rises by anbout 1mb every second, and keeps on going!
I was under the impression garbage collection would take of anything, but to be sure I ensure I dispose any objects after using them. I know without code it's hard to diagnose, but there's a lot of it and I'm looking more for general advice.
解决方案but to be sure I ensure I dispose any objects after using them
Dispose() is not directly related to memory management or leaks.
You'll have to look for unused objects that are still 'reachable'. Use a memory-profiler to find out.
You can start with the free CLR-Profiler.
更多推荐
C#内存泄露?
发布评论