×

Loading...
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务

You can use SOS Debugging Extension (SOS.dll) in Visual Studio.

It can be used to get information about the garbage collector, objects in memory, threads and locks, call stacks and more. The details about using it can be find from folowing URL

BTW, you might try force garbage collection (to call GC.Collect() after instance is eliminated.) to solve out of memory problem (it could lower performance).

And it is strongly recommended that your object inherits IDisposable Interface and implements a Dispose Method to explicitly release unmanaged resources

HTH
Report

Replies, comments and Discussions:

  • 工作学习 / 学科技术讨论 / does anyone know how to test and track memory leak of C# application? I
    have an application in which a instance is added and deleted repeatly and eventually it is out of memory. Is there any way to know that a instance is completely deleted and there is no other reference used by other instance?
    • .net framwork本身有memory leak,.net也能自己管理内存,所以普通内存不用管,你要专注也windows资源,例如GDI objects,小心那些windows API,
    • Check this and see if post help you resolve a problem
    • use .Net Memory Profiler tool. it is a pretty cool tool.
    • the following type of object will leak: 1) image, e.g. form, graph 2) file 3) com object
      • no wonder since those are all unmanaged resource
    • You can use SOS Debugging Extension (SOS.dll) in Visual Studio.
      It can be used to get information about the garbage collector, objects in memory, threads and locks, call stacks and more. The details about using it can be find from folowing URL

      BTW, you might try force garbage collection (to call GC.Collect() after instance is eliminated.) to solve out of memory problem (it could lower performance).

      And it is strongly recommended that your object inherits IDisposable Interface and implements a Dispose Method to explicitly release unmanaged resources

      HTH